1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
rosijanka [135]
4 years ago
15

In this assignment you are to implement a recursive-descent recognizer with a web interface for the BNF grammar given below. Bas

ed 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
Engineering
1 answer:
Gala2k [10]4 years ago
3 0

Answer:

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

Explanation:

You might be interested in
4. Water vapor enters a turbine operating at steady state at 1000oF, 220 lbf/in2 , with a volumetric flow rate of 25 ft3/s, and
hodyreva [135]
Yes i is the time of the day you get to frost the moon and back and then you can come over and then go to hang out with me me and then go to hang out
6 0
4 years ago
A 10MHz clock frequency is applied to a cascaded counter consisting of a modulus-5 counter, a modulus-8 counter and two modulus-
rewona [7]

If a clock frequency is applied to a cascaded counter, The lowest output frequency available will be

  • The lowest output frequency will be = 2.5kHz

<h3>Cascade Counter</h3>

For a cascade counter,

Overall frequency = 5*8*10*10

Overall frequency = 4000

<h3>Lowest Frequency</h3>

Therefore,

the lowest frequency

F = \frac{10*10^6}{4*10^3}\\\\F = 2500Hz\\\\F = 2.5kHz

For more information on frequency, visit

brainly.com/question/17029587?referrer=searchResults

4 0
2 years ago
How to build a robot
Anuta_ua [19.1K]
Seriously? Ok

first, get some good quality metal, preferably aluminum, if you want to avoid rust.

build in the the shape of a robot, you can use a doll to help you if you are a beginner, but feel free to shape it the a Star Wars Character!

create an AI (now you said robot not AI) and fix everything up.
7 0
4 years ago
What type of siege engines were used by Saladin to capture Jerusalem in 1187?
mariarad [96]

Answer:

LOTS

Explanation:

Catapults, Towers, and Trebuchets were all used by Saladin to capture Jerusalem in 1187

8 0
3 years ago
Suppose the following two events occur at the same time: the Chicago Cubs win the World Series, and the workers who make Cubs me
Annette [7]

Answer:

the answer would be decrease decrease

3 0
4 years ago
Other questions:
  • Vehicles arrive at a single toll booth beginning at 8:00 A.M. They arrive and depart according to a uniform deterministic distri
    9·1 answer
  • The function below takes a single parameter, a list of numbers called number_list. Complete the function to return a string of t
    14·1 answer
  • Given that the debouncing circuit is somewhat expensive in terms of hardware (2 NAND gates, 2 resistors, and a double-pole, sing
    9·1 answer
  • What's the difference between a GED and a Diploma?
    12·1 answer
  • Hi all, could you solve this please?<br> What is the value of the resistance R
    14·1 answer
  • Can someone please help me with this. Thank you. Ill mark you as brainly.
    11·1 answer
  • The thermal energy is carried by electromagnetic waves
    12·1 answer
  • determine the optimum compressor pressure ratio specific thrust fuel comsumption 2.1 220k 1700k 42000 1.004
    8·1 answer
  • Solid Isomorphous alloys strength
    11·1 answer
  • Lynx eat snowshoe hares, and snowshoes hears eat plants. Which term can be applied to the lynx in this food chain example? Prima
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!