Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Datalog Engines In Databases

Authors: Bas Ketsman ,Paraschos Koutris

1st Edition

1638280428, 978-1638280422

More Books

Students also viewed these Databases questions