Re: How to implement flex's (...)?{1,n} construct ?
Posted By:
Terence_Parr
Posted On:
Monday, May 7, 2001 10:55 PM
ANTLR currently does not have a {1,n} operator just ?, +, *. It is somewhat of a pain, but I usually just check the count during the semantic analysis or translation phase.
There is always a trade-off between how strict your grammar is, how easy it is to write, and how much work you have to do afterwards. For example, to parse C++ you usually are very loose in the parser and very strict in the analysis phase.