Add some compiler features and documentation (#147)

* update doc

* add disassemble and type checking

* improve compiler error messages
This commit is contained in:
water111
2020-12-01 21:39:46 -05:00
committed by GitHub
parent 21fbdce7aa
commit 71dda76e2b
30 changed files with 1533 additions and 351 deletions
+12 -3
View File
@@ -108,16 +108,25 @@ void TextDb::link(const Object& o, std::shared_ptr<SourceText> frag, int offset)
/*!
* Given an object, get a string representing where it's from. Or "?" if we can't find it.
*/
std::string TextDb::get_info_for(const Object& o) {
std::string TextDb::get_info_for(const Object& o, bool* terminate_compiler_error) {
if (o.is_pair()) {
auto kv = map.find(o.heap_obj);
if (kv != map.end()) {
if (terminate_compiler_error) {
*terminate_compiler_error = kv->second.frag->terminate_compiler_error();
}
return get_info_for(kv->second.frag, kv->second.offset);
} else {
return "?";
if (terminate_compiler_error) {
*terminate_compiler_error = false;
}
return "?\n";
}
} else {
return "?";
if (terminate_compiler_error) {
*terminate_compiler_error = false;
}
return "?\n";
}
}