Question
This is an antlr g4 file.I am trying to figure out why the system.out.println on the num parse rule never hits. grammar csce322Homework01Part01; /* *
This is an antlr g4 file.I am trying to figure out why the system.out.println on the num parse rule never hits.
grammar csce322Homework01Part01;
/*
* Lexer Rules
*/
LBEGINING : ('{') {System.out.println("Begin List");} ;
LENDING : ('}') {System.out.println("Conclude List");} ;
RENDING : ('#') {System.out.println("Conclude Row");} ;
DBEGINING : ('[') {System.out.println("Begin Domino");} ;
DENDING : (']') {System.out.println("Conclude Domino");};
COMMA : (',') ;
NUMBER : [0-9]+ ;
WHITESPACE : ( '\t' | ' ' | ' ' )+ {skip();} ;
TRAINS : ' HANDS : ' SECTIONBEGINING: '<<' ; SECTIONENDING: '>>' {System.out.println("Conclude Section");}; dominoes: section+ EOF; section: SECTIONBEGINING (TRAINS|HANDS) list+ SECTIONENDING; list: LBEGINING domino+ LENDING RENDING; domino: DBEGINNING num COMMA num DENDING ; num: (NUMBER)*{System.out.println("Half: " + $NUMBER.text);};
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started