A simple question on JavaCC
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   PoornaChandra_Raju
Posted On:   Tuesday, October 2, 2001 03:42 AM

I am using JavaCC utility to generate a parser. Now I am writing the grammar in ".JJ" file. I have three tokens defined say TokenA: "A", TokenB: "B" and TokenC: "C". I have to write a statement in my grammar(.JJ file) such that, the above said tokens can appear in the any of the following ways, 1) All the tokens are optional Example : ABC or AB or Ac or A or nothing 2)The tokens can appear in any order Example: ABC or CBA or ACB or ..... 3) A token can appear only once Example: AAB ---> is wrong, becaue "A" appears twice. Expecting an early reply...    More>>

I am using JavaCC utility to generate a parser. Now I am writing the grammar in ".JJ" file.


I have three tokens defined say TokenA: "A", TokenB: "B" and TokenC: "C".
I have to write a statement in my grammar(.JJ file) such that,
the above said tokens can appear in the any of the following ways,


1) All the tokens are optional

Example : ABC or AB or Ac or A or nothing


2)The tokens can appear in any order

Example: ABC or CBA or ACB or .....


3) A token can appear only once

Example: AAB ---> is wrong, becaue "A" appears twice.


Expecting an early reply...


Thanx in advance....


Regards,


Poorna.

   <<Less
About | Sitemap | Contact