I want to create C code. I will not read from the input file, one line at a time (like, for example, the compiler). Rather, I will parse user input as it arrives one line at a time.
I would prefer to detect and handle bad input in lexer / parser, e.g.
foo : "FOO";
bar : "BAR";
baz : "BAZ";
grammar : foo "=" BAZ
| foo "=" BAR
| <some non-existent Antrl-else> : {printf(stderr, "bad input\n");}
;
OK, if I cannot catch it in lexer / parser, it seems to me that I need to use it displayRecognitionError(), but like <
Can someone point me to a very simple example that generates C code and shows some error handling for invalid input?
Thanks!
Alright, generosity, jupipe!
But only for a real, working answer, with real working code. There is no "use the X () method" without wxample.