Question: This project consists of developing an interpreter for a minimal form (subset) of the Lua language. This minimal form of Lua has only 1 data
This project consists of developing an interpreter for a minimal form (subset) of the Lua language. This minimal form of Lua has only 1 data type, integer, and the only identifiers are single letters. Lua is not case sensitive. The specification of the grammar is given below.
Download Lua http://www.lua.org/download.html
Reference Manual http://www.lua.org/manual/5.1/manual.html
The interpreter will process a Lua program and build some intermediate data structures. These data structures will then be interpreted to execute the program. All tokens in this language are separated by white space. The parsing algorithm should detect any syntactical or semantic error. The first such error discovered should cause an appropriate error message to be printed, and then the interpreter should terminate. Run-time errors should also be detected with appropriate error messages being printed.
Question:
Develop a complete parser in Java that executes with the scanner. You must show the execution of this program by using a relevant source line as input, the program must show the corresponding statement recognized. Write a short report describing the work performed. Include the source program, input and output
Grammar for the (subset of Lua) language
Lexical Analyzer
id ? letter
literal_integer ? digit literal_integer | digit assignment_operator ? = le_operator ?
ge_operator ? >=
gt_operator ? > eq_operator ? = = ne_operator ? ~= add_operator ? + sub_operator ? - mul_operator ? * div_operator ? /
THIS IS THE SCANNER CODE. PLEASE USE THIS CODE TO DEVELOP A COMPLETE PARSER THAT WILL EXECUTE THIS SCANNER CODE IN JAVA. 


41 answers import java.util.Scanner; public class ScannerDemof public static void main (String[] arguments) Scanner input- new Scanner (System.in); String username; double age; String gender; String marital_status; int telephone_number; // Allows a person to enter his/her name Scanner one new Scanner (System.in); System.out.println("Enter Name:" ); usernameone.next); System.out.println("Name accepted " username); // Allows a person to enter his/her age Scanner twonew Scanner (System.in); System.out.println("Enter Age:" ) age -two.nextDouble(); System.out.println("Age accepted "age); // Allows a person to enter his/her gender Scanner three new Scanner (System.in); System.out.println( "Enter Gender:"); gender-three.next; System.out.println( "Gender accepted" gender); 41 answers import java.util.Scanner; public class ScannerDemof public static void main (String[] arguments) Scanner input- new Scanner (System.in); String username; double age; String gender; String marital_status; int telephone_number; // Allows a person to enter his/her name Scanner one new Scanner (System.in); System.out.println("Enter Name:" ); usernameone.next); System.out.println("Name accepted " username); // Allows a person to enter his/her age Scanner twonew Scanner (System.in); System.out.println("Enter Age:" ) age -two.nextDouble(); System.out.println("Age accepted "age); // Allows a person to enter his/her gender Scanner three new Scanner (System.in); System.out.println( "Enter Gender:"); gender-three.next; System.out.println( "Gender accepted" gender)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
