YALR (Yet Another Lexer Refactor)
This commit is contained in:
parent
72a6075123
commit
99db57dcfd
10 changed files with 208 additions and 217 deletions
27
src/nlx.nim
27
src/nlx.nim
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue