Hello, Judging by those examples I think regex matching is your best bet.
Michael On 13 May 2011 00:22, Alain Perry <[email protected]> wrote: > Hi there, > > I'm an absolute newbie when it comes to lexers and parsers. I might > have fiddled some with lex- and yacc-style tools while I was a CS > student, but not much of it has been left in my volatile brain. > > The thing is, I'm curious if a tool like antlr is the right one for a > particular job: I need (surprise) to parse some strings that contain > tokens of interest. Thing is, these tokens are incredibly loosely > defined. Here are some examples where I need to detect the part > between braces (the braces aren't there in the real world): > > [123456] this is some sample text > [12:34] this is some more sample text > [123456] some more... > [12:34:56^2] another example > [12:34:56@bleh] still another > [12:34:56^1@blah] and a last one, just for the fun of it. > > On the contrary, the strings [12345], [1234567], [12:34:5] etc. should > not be detected as a token of interest. > > So as I said above, my question is: should I be using antlr to detect > these things ? Should I stick with regex'es ? > > To be honest and since I'm a playful type of guy, I started writing a > grammar definition for my problem. I might post it here to treat you > all knowledgeable people to a good laugh. But I might be interested > first in any online (and free, for the time being) resource you would > point me to in order to not make to much of a fool of myself and get > to know more about this stuff in a practical and not too theoretical > kind of way. > > Now, let me just thank you for reading till this point. > > Regards, > > -- > Alain Perry > > 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.
