Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please don't use chat gpt use your mind Given the grammar defined by the following set of production rules in the normal BNF : project-declaration

please don't use chat gpt use your mind

Given the grammar defined by the following set of production rules in the normal BNF : project-declaration project-def "." project-def project-heading declarations compound-stmt project-heading project "name" ";" declarations const-decl var-decl subroutine-decl const-decl const const-list | const-list const-name = integer-value ; const-list | var-decl var var-list | var-list var-item ; var-list | var-item name-list ":" int name-list var-name more-names more-names , name-list | subroutine-decl subroutine-heading declarations compound-stmt ; | subroutine-heading subroutine "name" ";" compund-stmt begin stmt-list end stmt-list statement ; stmt-list | statement ass-stmt | inout-stmt | if-stmt | while-stmt | compound-stmt | ass-stmt name ":=" arith-exp arith-exp term arith-exp-prime arith-exp-prime add-sign term arith-exp-prime | term factor term-prime term-prime mul-sign factor term-prime | factor "(" arith-exp ")" | name-value name-value "name" | "integer-value" add-sign "+" | "-" mul-sign "*" | "/" | % inout-stmt scan "(" "name" ")" | print "(" name-value ")" if-stmt if bool-exp then statement else-part endif else-part else statement | while-stmt while bool-exp do statement bool-exp name-value relational-oper name-value relational-oper "=" | "|=" | "<" | "=<" | ">" | "=>"

Notes: (0) All names and integer-value are user defined names and values in the source code. (1) The tokens in bold letters are reserved words. (2) The words between are terminals (terminal tokens).

Write an LL(1) predictive parser for the abov e grammar, that is, using LL(1) parsing table. * You must work individually, any signs of cheating will be penalized severely. * Your program will be tested with a random program. * No programs will be accepted after the due date. * In the ERROR function, report the error clearly and precisely showing the line and token where the Error occurs and exit the program (panic mode error handling.

please don't use chat gpt use your mind solve it in Java

solve it

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

Step: 3

blur-text-image

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

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

Describe the major barriers to the use of positive reinforcement.

Answered: 1 week ago

Question

Project management skills and/or experience desirable

Answered: 1 week ago