Compiler/AST interpreter: Difference between revisions
m
Added ;Task
imported>Acediast (→{{header|COBOL}}: Syntax highlighting.) |
m (Added ;Task) |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1:
{{task}}{{task heading|AST interpreter}}
An AST interpreter interprets an [https://en.wikipedia.org/wiki/Abstract_syntax_tree Abstract Syntax Tree (AST)]
produced by a [[Compiler/syntax_analyzer|Syntax Analyzer]].
;Task
Take the AST output from the Syntax analyzer [[Compiler/syntax_analyzer|task]], and interpret it as appropriate.
Line 6,822:
{{libheader|Wren-fmt}}
{{libheader|Wren-ioutil}}
<syntaxhighlight lang="
import "./fmt" for Conv
import "./ioutil" for FileUtil
var nodes = [
Line 7,077:
{{works with|Zig|0.11.0}}
To simplify memory allocation management <tt>std.heap.ArenaAllocator</tt> is used in the code below. This allows all an arena's allocations to be freed together with a single call to arena.deinit()
=={{header|Zig}}==
<syntaxhighlight lang="zig">
|