Files
honey/source/main.hon
T
2026-07-23 10:56:53 +02:00

55 lines
1.0 KiB
Plaintext

import "@std/debug"
import "@std/mem"
test import "@std/enums"
test import "@std/arraylist"
test import "@std/hashmap"
test import "@std/static_string_map"
import "@source/strpool"
import "@source/lexer"
test import "@source/strpool"
program ::
`# these are immutable
`x :: 32
`y :: 3.2
`
`# these are mutable
`z u32 = 54
`
`# keywords
`if
`else
`for
`while
`func
`return
`
`main func() void {}
# cross-cutting concern, hence global singleton
strings StringPool = undefined
main func() void {
strings = strpool.init(mem.c_allocator)
defer strpool.deinit(&strings)
debug.print("PROGRAM::[[\n{}\n]]\n\n", {program})
scan_state lexer.State = lexer.init(mem.c_allocator)
defer lexer.deinit(&scan_state)
lexer.scan(&scan_state, program) catch |err| {
debug.print("failed to scan: {}\n", {err})
return
}
debug.print("TOKENS::[[\n", {})
for scan_state.tokens.items |token| {
debug.print("{}\n", {token.kind})
}
debug.print("]]\n", {})
}