std/ tree, use (import) and class syntax

- std/ layout: std/lang/{lexer,parser,checker,compiler}.cat moved from src/catscript
- std/io/io.cat, std/fs/fs.cat, std/math/math.cat modules
- use "path.cat": import another unit (compile+run in the same VM)
- class NAME [extends BASE] ... end: methods, inheritance via __index,
  default new constructor (runs optional init), tables are callable
- examples/classes.cat, tests/std.cat; 48/48 tests
This commit is contained in:
Minus committed 2026-11-16 01:53:53 +00:00
1 parent 3c20496c78
commit ef305e7824
19 files changed
+370 -9

No files matched your search

+4 -4
View File
@@ -5,10 +5,10 @@
-- This proves the front-end is self-hosted: given catscript source text,
-- the catscript programs compile it to bytecode and execute it.
dofile("src/catscript/lexer.cat")
dofile("src/catscript/parser.cat")
dofile("src/catscript/checker.cat")
dofile("src/catscript/compiler.cat")
dofile("std/lang/lexer.cat")
dofile("std/lang/parser.cat")
dofile("std/lang/checker.cat")
dofile("std/lang/compiler.cat")
function selfhost_compile(src)
local toks = lexer_tokenize(src)