x
Reimplement Assignment 3 using ANTLR. Notes:
complex.g4
plan.g4
.
*
to into ones that use recursively
defined nonterminals; for example,
a -> b (c)*can be rewritten as
a -> b multiple_cs multiple_cs -> ε multiple_cs -> c multiple_cs
something : TOKEN1 somethingElse TOKEN2 {x = a} {y = b} ;Another way to fix complex actions that cannot fit on one line is to write a function and call that instead. Those actions would go in a
@header
section as illustrated in
the eval example.
Submit the following
antlr4(with no arguments) will print the version number on the first line of output. You could simply include that line or just record the version number.
plan.g4
and any
supporting Python files you wrote.
You can receive substantial partial credit for a solution that just identifies inputs as legal or not. In such cases, be sure to show it runs on multiple legal inputs and that it does catch errors on multiple incorrect solutions.