Question

Build a Context-Free Grammar in Chomsky Normal Form that implements the following language features: (a) an...

Build a Context-Free Grammar in Chomsky Normal Form that implements the following language features: (a) an integer-based data type, (b) a value-type variable declaration of an integer data type, and (c) an assignment expression that allows for two integer-based variables to be added together. Examples: (a) define an integer data type (b) int a; (c) a = 2 + 3;

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Context Free Grammer

S->ABA
A->a|b
B->+

The conversion to Chomsky Normal Form has four main steps:

1. Get rid of all ε productions.

2. Get rid of all productions where RHS is one variable.

3. Replace every production that is too long by shorter productions.

4. Move all terminals to productions where RHS is one terminal.

Chomsky Normal Form

S0 -> AC
S -> AC
A -> a | b
B -> +
C -> BA

Add a comment
Know the answer?
Add Answer to:
Build a Context-Free Grammar in Chomsky Normal Form that implements the following language features: (a) an...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT