Skip to content

Commit

Permalink
compilable on OSX
Browse files Browse the repository at this point in the history
  • Loading branch information
cielavenir committed Oct 26, 2019
1 parent 221d00e commit e709cd7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
8 changes: 4 additions & 4 deletions src/build/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
LLVM_LINK_OPTION := `llvm-config --cxxflags --system-libs --ldflags --libs core` -fexceptions -O3 -std=gnu++17 -std=c++17 -lstdc++fs
LLVM_OPTION := -I/usr/lib/llvm-6.0/include
CC := g++ -std=gnu++17 -std=c++17 -lstdc++fs -O3
LLVM_LINK_OPTION := `/usr/local/opt/llvm@8/bin/llvm-config --cxxflags --system-libs --ldflags --libs all` -fexceptions -O3 -std=gnu++17 -std=c++17 -lboost_filesystem
LLVM_OPTION := -I/usr/local/opt/llvm@8/include -I/usr/local/opt/flex/include
CC := clang++ -std=gnu++17 -std=c++17 -O3
all: blawn
blawn: builtins.o errors.o main.o compiler.o driver.o node.o parser.o lexer.o ast_generator.o node.o ir_generator.o utils.o blawn_context.o errors.o
$(CC) -g -o blawn main.o compiler.o driver.o parser.o lexer.o ast_generator.o \
Expand All @@ -18,7 +18,7 @@ parser/parser.tab.cc ../compiler/parser/parser.tab.hh: ../compiler/parser/parser
cd ../compiler/parser && bison -d parser.yy -r all --report-file=log.log
cd ../compiler/parser && python3 patch.py
lexer.o: ../compiler/parser/lexer.ll
cd ../compiler/parser && flex++ -d lexer.ll
cd ../compiler/parser && /usr/local/opt/flex/bin/flex++ -d lexer.ll
$(CC) -g -c -o lexer.o ../compiler/parser/lex.yy.cc $(LLVM_OPTION)
main.o: ../compiler/parser/main.cpp
$(CC) -g -c -o main.o ../compiler/parser/main.cpp $(LLVM_OPTION)
Expand Down
6 changes: 0 additions & 6 deletions src/build/bin/while.blawn

This file was deleted.

7 changes: 4 additions & 3 deletions src/compiler/compiler/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <iostream>
#include <fstream>
#include <memory>
#include <experimental/filesystem>
#include <boost/filesystem.hpp>
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/TargetSelect.h"
Expand All @@ -21,7 +21,8 @@
#include "../utils/utils.hpp"
#include "compiler.hpp"

using namespace std::experimental;
//using namespace std::experimental;
using namespace boost;

std::string self_app_path;

Expand Down Expand Up @@ -175,7 +176,7 @@ int compile(int argc, char** argv) {
module->print(stream, nullptr);
auto commands = get_compile_commands(argc, argv);
for (auto& command : commands) {
bool is_failed = system(command.c_str());
bool is_failed = ::system(command.c_str());
if (is_failed) {
std::cout << "compilation failed.\n....Don't mind!" << std::endl;
commands.push_back("rm " + abs("tmp") + "/*.s");
Expand Down
10 changes: 5 additions & 5 deletions src/compiler/parser/lex.yy.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#line 3 "lex.yy.cc"
#line 2 "lex.yy.cc"

#define YY_INT_ALIGNED short int

Expand Down Expand Up @@ -602,9 +602,9 @@ static const flex_int16_t yy_rule_linenum[52] =
#define yyterminate() return Blawn::Parser::token::END;
#define YY_NO_UNISTD_H
#define YY_USER_ACTION loc->step(); loc->columns(yyleng);
#line 606 "lex.yy.cc"
#line 605 "lex.yy.cc"
#define YY_NO_INPUT 1
#line 608 "lex.yy.cc"
#line 607 "lex.yy.cc"

#define INITIAL 0

Expand Down Expand Up @@ -802,7 +802,7 @@ YY_DECL
#line 72 "lexer.ll"


#line 806 "lex.yy.cc"
#line 805 "lex.yy.cc"

while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
Expand Down Expand Up @@ -1296,7 +1296,7 @@ YY_RULE_SETUP
#line 272 "lexer.ll"
ECHO;
YY_BREAK
#line 1300 "lex.yy.cc"
#line 1299 "lex.yy.cc"

case YY_END_OF_BUFFER:
{
Expand Down

0 comments on commit e709cd7

Please sign in to comment.