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: [email protected] [mailto:antlr-interest- > [email protected]] On Behalf Of [email protected] > Sent: Monday, September 13, 2010 7:37 AM > To: [email protected] > 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 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.
