[antlr-interest] Simple question, Hard answer?

Bill Mayfield antlrinterest at gmail.com
Wed Sep 3 02:13:58 PDT 2008


Hi,

Suppose I want to recognize each pattern 'okko' in a random string of
characters. Some examples:

aaaaaoookoooookkooooaaa -> should yield one match of 'okko'
aaaokkookko -> should yield two matches of 'okko'



Here is a grammar that won't work ;o)

grammar test;

start	:	.* pattern .*;

pattern	:	T1 T2 T2 T1;


T1	:	'o';
T2	: 	'k';



No matter what grammar I try. I can't get it to work... how hard can it be?


Thanks for any input you may provide,
Bill


More information about the antlr-interest mailing list