> To make it more user friendly, the case like:
>ID SINGLE_SPACE SINGLE_SPACE ID
> should treat it as one SINGLE_SPACE without throwing syntax error.
Presumably there is some aspect of your grammar outside this fragment that
keeps you from just saying:
expr
: expr expr /* why
Hi John,
Your suggestion inspired me. I came up a simpler solution: instead of
eating spaces after NUMBER or ID, I did it in binary operators (such as
PLUS_SIGN '+') and special signs (such as LEFT_ROUND_BRACKET '(' ).
In Flex file only,
space [ ]
blank {space}*
...
%%
...
Hi Ron,
I tried to simplify my production rule to present here. The non-terminal
expr can be derived from more non-terminal besides ID and NUMBER. But I can
safely assume that the boundary of expr is not SINGLE_SPACE.
SINGLE_SPACE should not be discarded in the following cases:
1. Between
Hi Ricky,
Just curious: What actually terminates an 'expr' production? For example,
if they were terminated by newlines and the parser encountered this token
stream:
ID SINGLE_SPACE '\n'
do you intend to treat that as a "missing right-hand-side of SINGLE_SPACE
operator" error?
Likewise, I