subject
Engineering, 03.04.2020 18:30 Miznatnasah

Using the grammar for real-number constants discussed in class, write a set of rewrite rules for signed real-number constants that allow an optional sign at the front of the constants. Use signed-real-const as the new start symbol. You can reuse as much or as little of the real-number constant grammar rules as you deem appropriate. Examples of valid signed real-number constants are:

-3.56, +17.E09, 4.95

Using the following rewrite rules for Boolean expressions, give a derivation for the Boolean expression (NOT((F AND T)) OR F). Also draw a derivation tree corresponding to the derivation.

bool-exp β†’ T |
β†’ F |
β†’ NOT ( bool-exp ) |
β†’ ( bool-exp AND bool-exp ) |
β†’ ( bool-exp OR bool-exp )
Using the following rewrite rules for Boolean expressions, find two different derivation trees for the Boolean expression NOT(T OR T AND F).

bool-exp β†’ T |
β†’ F |
β†’ NOT ( bool-exp ) |
β†’ bool-exp AND bool-exp |
β†’ bool-exp OR bool-exp
Using the following rewrite rules for arithmetic expressions, draw a derivation tree for the expression 5*3+1+4.

expr β†’ expr add-op term | term
term β†’ term mult-op factor | factor
factor β†’ ( expr ) | digit-seq
add-op β†’ + | -
mult-op β†’ * | DIV | MOD
digit-seq β†’ digit digit-seq | digit
digit β†’ 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
Using the following rewrite rules for arithmetic expressions, draw a derivation tree for the expression 5*3+1+4.

expr β†’ term { add-op term }
term β†’ factor { mult-op factor }
factor β†’ ( expr ) | digit-seq
add-op β†’ + | -
mult-op β†’ * | DIV | MOD
digit-seq β†’ digit digit-seq | digit
digit β†’ 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
Note: A pair of new special symbols ('{' and '}') is used in the rewrite rules above. The meaning of {...} is that the string of nonterminal and terminal symbols appearing between { and } can be repeated 0 or more times. For instance, the first rewrite rule:

expr β†’ term { add-op term }
is equivalent to the following (infinite) set of rewrite rules:

expr

β†’ term |

β†’ term add-op term |

β†’ term add-op term add-op term |

β†’ term add-op term add-op term add-op term |

β†’ ...

ansver
Answers: 2

Another question on Engineering

question
Engineering, 03.07.2019 15:10
Two flowing streams of argon gas are adiabatically mixed to form a single flow/stream. one stream is 1.5 kg/s at 400 kpa and 200 c while the second stream is 2kg/s at 500 kpa and 100 ? . it is stated that the exit state of the mixed single flow of argon gas is 150 c and 300 kpa. assuming there is no work output or input during the mixing process, does this process violate either the first or the second law or both? explain and state all your assumptions.
Answers: 1
question
Engineering, 04.07.2019 18:10
Apump is used to circulate hot water in a home heating system. water enters the well-insulated pump operating at steady state at a rate of 0.42 gal/min. the inlet pressure and temperature are 14.7 lbf/in.2, and 180Β°f, respectively; at the exit the pressure is 60 lbf/in.2 the pump requires 1/15 hp of power input. water can be modeled as an incompressible substance with constant density of 60.58 lb/ft3 and constant specific heat of 1 btu/lb or. neglecting kinetic and potential energy effects, determine the temperature change, in Β°r, as the water flows through the pump.
Answers: 1
question
Engineering, 04.07.2019 18:10
Calculate the bore of a cylinder that has a stroke of 18 inches and an extension time of 6 seconds at a flow rate of 4 gal/min.
Answers: 3
question
Engineering, 04.07.2019 19:10
What is a monomer? how do they form a ploymer from the view point of chemical bonding?
Answers: 1
You know the right answer?
Using the grammar for real-number constants discussed in class, write a set of rewrite rules for sig...
Questions
Questions on the website: 13722361