subject
Engineering, 07.03.2020 00:22 tannerweberp5r8sg

In this assignment you are to implement a recursive-descent recognizer with a web interface for the BNF grammar given below. Based on the pseudocode you have done in PL Assignment 1, this is a good opportunity to develop the web programming skills required by today's IT field. You must ask the user for input stream.

EXP ::= EXP + TERM | EXP - TERM | TERM
TERM ::= TERM * FACTOR | TERM / FACTOR | FACTOR
FACTOR ::= ( EXP ) | DIGIT
DIGIT ::= 0 | 1 | 2 | 3

My pseudocode for PL 1:

procedure exp()
term()
if (token == ‘+’){
match(‘+’)
term()
}
Else (if token == ‘-‘){
match(‘-‘)
term()
}
else
errorsfound
procedure term()
factor()
if (token == ‘*’){
match(‘*’)
factor()
}
else if (token == ‘/’){
match(‘/’)
factor()
}
else
errorsfound
procedure factor()
if (token == ‘(‘){
match(‘(‘)
exp()
match(‘)’)
}
else

digit()
procedure digit()
if token == ‘0’
match(‘0’)
else if token == ‘1’
match(‘1’)
else (if token == ‘2’)
match(‘2’)
else if (token ==’3’)
match(‘3’)
else
errorfound
match(t)
if (token == t)
nexttokenpointer
else
errorfound



Basically create a javascript that can read a user's input thats a simple mathematical expression using ( ) * / + - and ends with $ (so that we know it terminates), and determine if that input is in a valid form or not. Example 2/(3+1)$ is valid, and 1*a$ is not valid

ansver
Answers: 3

Another question on Engineering

question
Engineering, 03.07.2019 19:30
When using the ohmmeter function of a digital multimeter, the leads are placed in what position relative to the component being tested? a. parallel b. control c. series d. line
Answers: 3
question
Engineering, 04.07.2019 18:10
The filament of an incandescent lamp has a temperature of 2000k. calculate the fraction of radiation emitted in the visible light band if the filament is approximated as blackbody
Answers: 2
question
Engineering, 04.07.2019 18:10
At 12 noon, the count in a bacteria culture was 400; at 4: 00 pm the count was 1200 let p(t) denote the bacteria cou population growth law. find: (a) an expression for the bacteria count at any time t (b) the bacteria count at 10 am. (c) the time required for the bacteria count to reach 1800.
Answers: 1
question
Engineering, 04.07.2019 18:10
Which of the following controllers anticipates the future from the slope of errors over time? a)-proportional b)-on/off c)-integral d)-derivative.
Answers: 2
You know the right answer?
In this assignment you are to implement a recursive-descent recognizer with a web interface for the...
Questions
question
Mathematics, 15.06.2021 03:30
question
Geography, 15.06.2021 03:30
Questions on the website: 13722367