On 04/07/2011 06:56, Fs Cc wrote:
> Hi Stephen,
>
> Thank you! Semantic predicates work for me. In fact, the lexer::xstrMode
> and lexer::inArray in following code are used to mimic the parser logic. We 
> need
> them because lexer is run before parser. Is it possible for ANTLR to merge the
> parser and the lexer into a single run? For example: when a parser rule is
> selected to run, ANTLR deduces the selected rule and select the correct lexer
> rule(just like how it select sub parser rules) to parse the raw string, so 
> that
> we can avoid introducing parser logic into lexer.

If you really want to do it that way, then you might want to consider 
using some other parser generator than ANTLR; AIUI, ANTLR is quite 
closely wedded to the philosophy of separation of lexical and 
grammatical structure. I've seen very few instances where a language 
actually needs smudging between the steps - usually it can be acheived 
by refactoring, reframing the idea of what lexical elements are used.

Sam

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to