From b43c94ca62a747f2f9fb222cdf887c041dd544bb Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 1 Nov 2025 16:28:08 +0200 Subject: feat!: Add basic lexer components --- src/System.cl | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/System.cl (limited to 'src/System.cl') 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); + ""; + }}; +}; -- cgit v1.3.1-23-gd82d