Purchase Solution

BNF grammar for boolean expression

Not what you're looking for?

Ask Custom Question

A) Create a BNF grammar that describes simple Boolean expressions of the form

var AND var
var OR var

where var is one of the symbols w, x, y, and z.

B) Modify your grammar from part (a) so that the Boolean expressions can be of the form

expr AND expr
expr OR expr

where expr is either a simple variable (w, x, y, or z) or an expression of the form

(var == var)
(var < var)
(var > var)

C) Modify your grammar one more time to allow a Boolean expression to have an arbitrary number of terms connected by either AND or OR. That is, your expressions can be of the form

expr AND expr OR expr OR expr AND expr....

Purchase this Solution

Solution Summary

Change in grammar is incremental, corresponding to modifications in Boolean expression specification.

Solution Preview

a.
<goal> ::= <var> AND <var> | <var> OR <var>
<var> ::= w | x | y | z

b.
<goal> ::= <expr> AND <expr> | <expr> ...

Purchase this Solution


Free BrainMass Quizzes
Geometry - Real Life Application Problems

Understanding of how geometry applies to in real-world contexts

Graphs and Functions

This quiz helps you easily identify a function and test your understanding of ranges, domains , function inverses and transformations.

Probability Quiz

Some questions on probability

Know Your Linear Equations

Each question is a choice-summary multiple choice question that will present you with a linear equation and then make 4 statements about that equation. You must determine which of the 4 statements are true (if any) in regards to the equation.

Multiplying Complex Numbers

This is a short quiz to check your understanding of multiplication of complex numbers in rectangular form.