Similar examples in other languages:
To build the below examples using JFlex:
java -jar ~cs540/JFlex.jar yourfile.l javac Yylex.javaThe first step creates the file Yylex.java (this name can be specified in the .l file), which is then compiled.
A copy of the Jar file for JFlex can be found here
slurpy -> slimp slump slimp -> A rest_slimp rest_slimp -> H rest_slimp -> B slimp C rest_slimp -> slump C slump -> d_or_e F f_string end d_or_e -> D d_or_e -> E f_string -> F f_string | lambda end -> slump end -> G Some strings in the language: AHDFG, ADFGCDFFFFFG, ABAEFGCCDFEFFFFFFG Some strings NOT in the lanuage: AHDFGA, DFGAH, ABABCC
/home/u1/white/byacc -J slurp2.yYou can also download and install your own version if you like.
public static void main (String [] args) throws IOException {
Parser yyparser = new Parser(new FileReader(args[0]));
yyparser.yyparse();
}
You can also read from standard input - this is the method I want you to use for assignments in this class.
public static void main (String [] args) throws IOException {
Parser yyparser = new Parser(new InputStreamReader(System.in));
yyparser.yyparse();
}
li $t0,2
lw $t1,b
lw $t2,c
add $t1,$t1,$t2
add $t0,$t0,$t1
sw $t0,a