Question

Python uses indention in its program structures. How do you define the syntax of a language...

Python uses indention in its program structures. How do you define the syntax of a language construct that uses indention? Give an example to describe.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:

There are two parts to create language:
    1. Lexeme specification: defines groups of characters that represent a single syntactic construct like token or terminal value
    2. Grammar specification: defines the valid combinations of syntactic constructs/tokens/terminal values that make up non-terminal values that express how the language can be used in level

start ::= list
        | list NEWLINE
        .

list ::= entry
        | list entry
        .

entry ::= STRING NEWLINE
        | STRING NEWLINE INDENT list DEDENT
        .

Sample if-statement:
x = true
if x:
   print("x is true")
else:
   print("x is false")

There are two parts to create language: 1. Lexeme specification: defines groups of characters that represent a single syntact

Add a comment
Know the answer?
Add Answer to:
Python uses indention in its program structures. How do you define the syntax of a language...
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