Question: Question : Develop a complete parser in Java that executes with this scanner code. Grammar for the (subset of Lua) language ? function id (

Question:

Develop a complete parser in Java that executes with this scanner code.

Question: Develop a complete parser in Java that executes with this scannercode. Grammar for the (subset of Lua) language ? function id () end ? | ? | | | | ? if then

Grammar for the (subset of Lua) language

? function id ( ) end

? |

? | | | |

? if then else end

? while do end

-> id

-> repeat until

? print ( )

?

? le_operator | lt_operator | ge_operator | gt_operator | eq_operator | ne_operator

? | |

? add_operator | sub_operator | mul_operator | div_operator

Lexical Analyzer

id -> letter

literal_integer -> digit literal_integer | digit

assignment_operator ->

ge_operator -> >=

gt_operator -> >

eq_operator ? = =

ne_operator -> ~=

add_operator -> +

sub_operator -> -

mul_operator -> *

div_operator -> /

Download Lua http://www.lua.org/download.html

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); 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!