The <expression>
part of a grammar rule can also contain grammar symbols.
Here is an example saying that the grammar symbol S
is parsed by parsing the grammar symbol T
:
S: T;
T: A;
terminals
A: 'a';
In a grammar rule, a grammar symbol can also be concatenated with another grammar symbol as well as a terminal. For example:
S: T T C T;
T: A B;
terminals
A: 'a';
B: 'b';
C: 'c';
This grammar accepts exactly the string ababcab
with optional white spaces allowed in between.
➡️ Next: Empty String
📘 Back: Table of contents