[ prog / sol / mona ]

prog


Zig

9 2023-10-15 19:43

>>7,8
That raises further questions. How can the evaluator handle words (like variable names) it hasn't seen before?

Also it sounds like evaluating arguments and passing them to a function just won't work.

10 2023-10-15 19:56

>>9
You only need to handle a small set of keywords to introduce the fundamental
primitives of the language, this is a finite set that you cal manually
implement on eval()
If you want to introduce new symbols you do the same thing you do in a normal
interperter, by introducing a mutable symbol table and adding symbols as
they are defined.
the else => branch above would search this table for the symbol and it would
evaluate it.

Also it sounds like evaluating arguments and passing them to a function just won't work.

If you can guarantee the result has a fixed type, you can pass the evaluation
result to a normal function, I did that in first print statement where it
expected an integer

30


VIP:

do not edit these