Engineering
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

answer
Answers: 3

Other questions on the subject: Engineering

image
Engineering, 04.07.2019 18:10, skpdancer1605
Ariver flows from north to south at 8 km/h. a boat is to cross this river from west to east at a speed of 20 km/h (speed of the boat with respect to the earth/ground). at what angle (in degrees) must the boat be pointed upstream such that it will proceed directly across the river (hint: find the speed of the boat with respect to water/river)? a 288 b. 21.8 c. 326 d. 30.2
Answers: 3
image
Engineering, 04.07.2019 18:10, dval1146
You are making beer. the first step is filling the glass carboy with the liquid wort. the internal diameter of the carboy is 15 in., and you wish to fill it up to a depth of 2 ft. if your wort is drawn from the kettle using a siphon process that flows at 3 gpm, how long will it take to fill?
Answers: 1
image
Engineering, 04.07.2019 18:10, ayoismeisjjjjuan
Manometers are good examples of measuring instruments, nowadays they are not as common as before. a)-capacitive probe gauges b)-gravitational gauges deformation ) gauges d)-digital gauges
Answers: 1
image
Engineering, 04.07.2019 18:10, selenamr
Ifa component is made of two or more materials with different modulus of elasticity (e), it is called a composite member and we calculate the factorΒ·n". mention the formula for calculating n". also, ifn> 1, explain what will happen to the 1. transformed. gi) ifn 1, what will happen to the material when transformed material when
Answers: 1
Do you know the correct answer?
In this assignment you are to implement a recursive-descent recognizer with a web interface for the...

Questions in other subjects:

Konu
Mathematics, 30.06.2019 21:30
Konu
Mathematics, 30.06.2019 21:30