Summary Files Commits Branches @commit @diff @stats
path: root / src / System.cl
diff options
context:
space:
mode:
Commitb43c94ca62a747f2f9fb222cdf887c041dd544bb (patch)
Author
 Syndamia <kamen@syndamia.com>
2025-11-01 16:28:08 +0200
Committer
 Syndamia <kamen@syndamia.com>
2025-11-01 16:28:08 +0200
Files43e0ea846844257cf46055e68cc2661056b05965 /src/System.cl
cool-self-hosted-b43c94ca62a747f2f9fb222cdf887c041dd544bb.tar
cool-self-hosted-b43c94ca62a747f2f9fb222cdf887c041dd544bb.tar.gz
cool-self-hosted-b43c94ca62a747f2f9fb222cdf887c041dd544bb.zip
Parent0830615386f036acc55a72b2548efb65526c761f (diff)
feat!: Add basic lexer components
1 files changed, 60 insertions, 0 deletions
-rw-r--r--src/System.cl60
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);
+ "";
+ }};
+};