I'm doing a syntactic Analixer with jflex + javacup. At the .cup gramatic I have this part:
SUBPPARAMLIST ::= lambda | "(" EXPLIST ")"
Where lambda mean nothing (SUBPPARAMLIST can be empty)
Well, I managed to create all my tokens correctly in my .flex, but I dont know how to create the lambda symbol. I hope you guys can help me, let me know if you dont understand my problem
WhatDoIWriteHere{return symbol(sym.lambda);}
The empty production (what you call "lambda") doesn't need a symbol, because it is empty. You express this by a production rule:
SUBPPARAMLIST ::= lambda | "(" EXPLIST ")" ;
lambda ::= ;
Quote: Each production in the grammar has a left hand side non-terminal followed by the symbol "::=", which is then followed by a series of zero or more actions, terminal, or non-terminal symbols, followed by an optional contextual precedence assignment, and terminated with a semicolon (;). Note the "...zero or more..."
Possibly the grammar parser is also capable of handling this:
SUBPPARAMLIST ::= "(" EXPLIST ")" | ;