YALR (Yet Another Lexer Refactor)

This commit is contained in:
Emile Clark-Boman 2025-06-19 08:48:31 +10:00
parent 72a6075123
commit 99db57dcfd
10 changed files with 208 additions and 217 deletions

View file

@ -1,22 +1,19 @@
import os
import noether/lexer/tok
import noether/lexer/tokstream
import noether/parser/parser
import noether/lib/io
import noether/lexer/[tok, tokstream]
# import noether/parser/parser
{.hint: "Don't forget to drink more water (^_^)".}
when isMainModule:
echo "Noether Lang Extras v0.1.0 - nlx"
if paramCount() > 0:
let filename = paramStr(1)
var tokStream = newTokStream(filename, isFile=true)
# # DumpTok
# while tokStream.progress():
# echo tokStream.currTok
var inStream = if paramCount() > 0: streamFile(paramStr 1)
else: streamString(readAll stdin)
# DumpTree
discard parse(tokStream)
else:
echo "usage: nlx filename"
var stream = newTokStream(inStream)
# # DumpTok
while stream.progress():
echo stream.tok
# DumpTree
# discard parse(tokStream)