Compiler/AST interpreter: Difference between revisions
Content deleted Content added
Added output sample. |
Corrected a bug with "\\n" and "\n" due to wrong behavior of "unescape". Used regular expression and replacements instead. |
||
Line 2,256:
#---------------------------------------------------------------------------------------------------
import re
proc loadAst(stream: Stream): Node =
Line 2,275 ⟶ 2,277:
return Node(kind: nIdentifier, name: fields[1])
of nString:
return Node(kind: nString, stringVal: str)
of nInteger:
return Node(kind: nInteger, intVal: parseInt(fields[1]))
|