Question

The question involves two parts and is for a compiler design course. See the image below for the question. It may help if you have used a tool called ANTLR and know about grammar files. Answer part 1 and part 2 correctly and I will give a positive rating. Thank you.Part 1: In BDL (badly designed language), the equal sign is the assignment operator. The language allows multiple assignments

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

part 1 :

asgn =>asgn = digit ++

asgn = digit + digit ++

i = j = k = digit + digit ++

  i = j = k = 1 + digit ++

  i = j = k = 1 + 1 ++

source :

antlr4 {
    source = file('src/main/antlr')
    output = file('build/generated-src/me/tomassetti/pythonast/parser')
    extraArgs = ['-package', 'me.tomassetti.pythonast.parser']
}

 

part 2 :

replacement of line 7 :

exp ? var1 : var 2 ;

(Now the two variables var1(j) and var2(k) will check those condition and then get assigned to the variable (i) .

Add a comment
Know the answer?
Add Answer to:
The question involves two parts and is for a compiler design course. See the image below for the question. It may help if you have used a tool called ANTLR and know about grammar files. Answer part 1...
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
ADVERTISEMENT