parsing hello.zig example with recursive descent

that was easy
This commit is contained in:
Andrew Kelley
2015-11-23 21:30:12 -07:00
parent 6b911f1e94
commit 1b24f4c73c
7 changed files with 379 additions and 104 deletions

View File

@@ -89,6 +89,8 @@ static int build(const char *arg0, const char *in_file, const char *out_file, Zi
AstNode *root = ast_parse(in_data, tokens);
assert(root);
fprintf(stderr, "\nAST:\n");
fprintf(stderr, "------\n");
ast_print(root, 0);
@@ -135,7 +137,7 @@ int main(int argc, char **argv) {
} else {
switch (cmd) {
case CmdNone:
zig_panic("unreachable");
zig_unreachable();
case CmdBuild:
if (!in_file) {
in_file = arg;
@@ -154,6 +156,6 @@ int main(int argc, char **argv) {
return build(arg0, in_file, out_file, &include_paths);
}
zig_panic("unreachable");
zig_unreachable();
}