Support parsing and testing unimplemented expressions (#957)

Co-authored-by: Jon Meow <46229924+jonmeow@users.noreply.github.com>
This commit is contained in:
Geoff Romer
2021-11-30 12:29:15 -08:00
committed by GitHub
co-authored by Jon Meow
parent be0c1e9da6
commit dc5e62fc7a
23 changed files with 463 additions and 147 deletions
+6 -1
View File
@@ -28,7 +28,12 @@ The parser is implemented using the flex and bison parser generator tools.
- [`syntax.ypp`](syntax/syntax.ypp) the grammar
The parser translates program text into an abstract syntax tree (AST), defined
in the [ast](ast/) subdirectory.
in the [ast](ast/) subdirectory. The `UnimplementedExpression` node type can be
used to define new expression syntaxes without defining their semantics, and the
same techniques can be applied to other kinds of AST nodes as needed. See the
handling of the `UNIMPL_EXAMPLE` token for an example of how this is done, and
see [`unimplemented_example_test.cpp`](syntax/unimplemented_example_test.cpp)
for an example of how to test it.
The [type checker](interpreter/typecheck.h) defines what it means for an AST to
be a valid program. The type checker prints an error and exits if the AST is