Skip to content

Commit

Permalink
Improves compiler: Implements first draft of compiler messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
ikskuh committed Jul 12, 2020
1 parent d25c63e commit f9e7e96
Show file tree
Hide file tree
Showing 9 changed files with 518 additions and 311 deletions.
90 changes: 90 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"files.associations": {
"array": "cpp",
"atomic": "cpp",
"hash_map": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"codecvt": "cpp",
"compare": "cpp",
"complex": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"ostream": "cpp",
"ranges": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cinttypes": "cpp",
"typeinfo": "cpp",
"valarray": "cpp",
"variant": "cpp",
"__bit_reference": "cpp",
"__config": "cpp",
"__debug": "cpp",
"__errc": "cpp",
"__functional_base": "cpp",
"__hash_table": "cpp",
"__locale": "cpp",
"__mutex_base": "cpp",
"__node_handle": "cpp",
"__nullptr": "cpp",
"__split_buffer": "cpp",
"__string": "cpp",
"__threading_support": "cpp",
"__tree": "cpp",
"__tuple": "cpp",
"ios": "cpp",
"locale": "cpp",
"queue": "cpp",
"stack": "cpp"
}
}
3 changes: 3 additions & 0 deletions exerciser.lola
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ Print("a"); // call_fn (script function)

Sleep(1); // call_fn (async script function)

extern refGlobal;
extern valGlobal;

Print(valGlobal); // load_global_name

Print(refGlobal); // load_global_name
Expand Down
10 changes: 10 additions & 0 deletions src/frontend/compile_lola_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ extern "C" bool compile_lola_source(uint8_t const *source, size_t sourceLength,
return false;
}

if (compiler.errors.errors.size() > 0)
{
for (auto const &err : compiler.errors.errors)
{
fprintf(stderr, "%s:%d:%d: error: %s\n", err.file_name.c_str(), err.row, err.column, err.message.c_str());
}
fflush(stderr);
return false;
}

// std::ofstream out(std::string(reinterpret_cast<char const *>(outFileName), outFileNameLen));
std::stringstream out;
compile_unit->save(out);
Expand Down
Loading

0 comments on commit f9e7e96

Please sign in to comment.