Sure, this is an example of input:
Automa : Automa_anbn
{1,2,}
{a,b}
{$,N}
{($,a)>(1,N);(N,a)>(1,NN);(N,b)>(2,#)}:
{(N,b)>(2,#)}.
i realize that i can't use a regular expression as token.. i must study more javacc :P
Tom Copeland wrote:
On Jun 19, 2009, at 11:38 AM, AlexanderPD wrote:
> Hi, i need to "convert" my grammar in JavaCC.. but javaCC doesn't
> accept
> loops in regular expression :(
>
> i tried to write this:
>
> TOKEN :
> {
> < AUTOMA : "Automa" >
> | < DUEPUNTI : ":" >
> | < AP2SL : < AUTOMA > <DUEPUNTI >
> <NOME>"\n{"<STATI>","<COPPIA>"\n"<TABTR>"." >
> | < NOME : ["A"-"Z"](["a"-"z","0"-"9"])+ >
> | < COPPIA: <STATI>","< COPPIA >"\n"<TABTR>":" | "}\n{"
> <LISTAALFABETO>
> "}\n}" <LISTASIMBOLIPILA >"}\n" >
> | < LISTASIMBOLIPILA : "$,"(<SPILA>",")+ >
> | < LISTAALFABETO : <ALFABETO>"," < LISTAALFABETO > | <ALFABETO> >
> | < TABTR : "{"<TRANSIZIONI>"}\n">
> | < TRANSIZIONI
> :"("(<SPILA>|"$")","(<ALFABETO>|"#")")->("<STATI>","<APILA>");"<
> TRANSIZIONI
>> | "("(<SPILA>|"$")","(<ALFABETO>|"#")")->("<STATI>","<APILA>")" >
> | < STATI : ["1"-"9"](["0"-"9"])* >
> | < ALFABETO : ["a"-"z"] >
> | < SPILA : ["A"-"Z"] >
> | < APILA : (<SPILA>)* >
> }
>
> and i get 3 looping errors :(
> How to solve this? I need to write a method for each looping state?
>
> Thank you, i'm getting mad on this :D
Hi Alexander -
Perhaps you may need to use a state stack in your tokenizer to solve
the problem. Can you post an example of the input data which you're
trying to parse?
Yours,
tom
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@javacc.dev.java.net
For additional commands, e-mail: users-help@javacc.dev.java.net