Notes on commucication between jflex and byaccj using yylval yylval is declared in Parser.java (the file generated by byaccj) as an instance of class ParserVal (ParserVal.java is also created by byacc.j). ParserVal is a class with public instance variables: public int ival; public double dval; public String sval; public Object obj; and a separate constructor taking a single parameter or each of the above four types and using them to initialize one of the 4 instance variables. Thus a new value can be stored in yylval by creating an instance using the constructor for the type of the value you wish to store. For example, if your (byaccj generated) parser is called p, then in your jflex file to assign the integer 55 you would write: p.yylval = new ParserVal(55); Inside your parser (byaccj file) the $n variables are also of type ParserVal, so you may read a value as $1.ival, for example. Note the "Object obj" field. Since all classes are derived either directly or indirectly from class Object you can use this to assign a reference to any class to yylval.obj. The next problem is to make yylval visible to your flex code. Since yylval is an instance variable of class Parser you must store a reference to your parser in you scanner. You will also have to write a new constructor for Yylex which will accept a reference to Parser and use this to initialize the stored reference to your parser. Thus, you may, in your jflex file, have: %{ private Parser parser; public Yylex(FileReader fr, Parser p) { this(fr); parser = p; } %} Now when you create your scanner from your byaccj file you will call this new constructor. Recall from a previous note that you will have provided a new constructor to Parser which took a FileReader as parameter. This new constructor now looks like: public Parser(FileReader fr) { this(); scanner = new Yylex(fr, this); } Confused? Of course you are! This logic is horribly convoluted. Contact me if you have problems untangling it.