[antlr-interest] Example of plugging in custom lexer to C-target?

Jim Idle jimi at temporal-wave.com
Mon Sep 13 09:46:24 PDT 2010


No one has needed to do this before, but all you have to do is generate a
really simple C lexer (one rule) and see that you need just a couple of
methods. Easiest way to see this is to single step one of the examples in
visual studio. Trace through the LT(1) call and you will see what happens
when you end up in the lexer.

Jim



> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of scott_boag at us.ibm.com
> Sent: Monday, September 13, 2010 7:37 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Example of plugging in custom lexer to C-
> target?
> 
> Hello all,
> 
> I apologize if this information is in some obvious place... so far I've
> not been able to locate it.
> 
> I would like to plug in a custom lexer to the C target generation.  To
> be specific, I want to plug in a Flex C++ lexer.  In Java I do this with
> JFlex, and it's really simple.  But I'm trying to reverse engineer the
> Lexer/TokenStreams/TokenSource/etc. for the C target, and it looks to be
> fairly tricky.  I'm hoping someone might have an example to make this a
> bit simpler?
> 
> (I'm constrained at the moment to 3.1.3).
> 
> Thanks!
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address



More information about the antlr-interest mailing list