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, 04.07.2019 18:10
Afluid flows with a velocity field given by v=(x/t)i.. determine the local and convective accelerations when x=3 and t=1.
Answers: 2
question
Engineering, 04.07.2019 18:20
A3-mm-thick panel of aluminum alloy (k 177 w/m-k, c 875 j/kg-k and ? = 2770 kg/m) is finished on both sides with an epoxy coating that must be cured at or above t,-150°c for at least 5 min. the production line for the curing operation involves two steps: (1) heating in a large oven with air at ts,0-175°c and a convection coefficient of h, 40 w/m2. k, and (2) cooling in a large chamber with air at 25°c and a con- vection coefficient of he 10 w/m2.k. the heating portion of the process is conducted over a time interval te which exceeds the ime required to reach 150°c by 5 min (h = r + 300 s). the coating has an emissivity of ? = 0.8, and the temperatures of the oven and chamber walls are 175 and 25°c, respectively. if the panel is placed in the oven at an initial temperature of 25°c and removed from the chamber at a safe-to-touch tempera ture of 37°c, what is the total elapsed time for the two-step curing operation?
Answers: 3
question
Engineering, 04.07.2019 18:20
Wiy doeres rere okhn a pump whon working betwon the same pressure range?
Answers: 2
question
Engineering, 04.07.2019 19:10
Estimate the change in specific internal energy au and specific enthalpy h from inlet to outlet for ethylene glycol (a liquid) flowing through each of the following devices: (a) a heat exchanger where the glycol temperature increases from 20 °c to 80 °c; (b) a pump operating at about 25 °c and increasing the glycol pressure from 100 kpa to 8 mpa.
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, 01.12.2020 21:20
question
Chemistry, 01.12.2020 21:20
question
Mathematics, 01.12.2020 21:20
question
Social Studies, 01.12.2020 21:20
Questions on the website: 13722363