-
Notifications
You must be signed in to change notification settings - Fork 2
%fallback
ksherlock edited this page Dec 19, 2015
·
2 revisions
The %fallback
directive allows for context sensitive terminals. If a terminal cannot be parsed, it will try again as it's fallback before throwing an error.
Consider a language where keywords are not reserved -- IF IF THEN THEN
might be a legal (and confusing) statement.
%fallback ID IF THEN
stmt ::= IF expr THEN stmt.
stmt ::= ID. // function call
expr ::= ID.