diff options
feat!: Add basic lexer components
1 files changed, 60 insertions, 0 deletions
| -rw-r--r-- | src/System.cl | 60 |
diff --git a/src/System.cl b/src/System.cl new file mode 100644 index 0000000..12f2210 --- /dev/null +++ b/src/System.cl @@ -0,0 +1,60 @@ +-- "Global" constructs + +class System inherits IO { + void: Object <- while false loop 0 pool; + + or(p: Bool, q: Bool) : Bool { + if p then true + else + if q then true + else false + fi + fi + }; + + and(p: Bool, q: Bool) : Bool { + if p then + if q then true + else false + fi + else false + fi + }; + + assert(condition: Bool, method_name: String, error_msg: String) : Object { + if not condition then + { + out_string("\n") + .out_string("Assertion failed at ") + .out_string(type_name()) + .out_string(".") + .out_string(method_name) + .out_string("(): ") + .out_string(error_msg) + .out_string("\n"); + abort(); + } + else + void + fi + }; + + not_implemented(method_name: String) : Object {{ + out_string("\n") + .out_string("Method ") + .out_string(type_name()) + .out_string(".") + .out_string(method_name) + .out_string("() isn't implemented!") + .out_string("\n"); + abort(); + }}; + not_implemented_retint(method_name: String) : Int {{ + not_implemented(method_name); + 0; + }}; + not_implemented_retstr(method_name: String) : String {{ + not_implemented(method_name); + ""; + }}; +}; |
