@cabhishek,
I'm wondering if you could explain a couple things in your lox interpreter code.
For example, sometimes you pass lexer as a var, sometimes not.
proc peek(lex: var Lexer): char
proc isAtEnd(lex: Lexer): bool
Run
Could you explain a little about this slight difference?
I've been doing something similar for the
Run
lang, following:
://interpreterbook.com/
Run
In the Lox resource, the author uses Java as the implementation lang. For
Monkey the author uses Go - a classless lang like Nim.
But in Go the author passes a pointer to the Lexer in order manipulate/modify
state in the lexer.
In your code I see Lexer is simply an object, not a ref object or a ptr.
Does defining the parameter as proc(lex: var Lexer) behave similar to a
pointer? This has the result of mutating state in the Lexer object? In other
words, it's like passing by reference rather than by value?
Another question, do you intend to experiment converting the Lox AST to Nim AST
and as a result have it become a compiled language rather than an interpreted
one?