Skip to content
Discussion options

You must be logged in to vote

Not really an answer, but sharing a sketch of an approach.

I tried gradually building up a series of smaller grammars (though I didn't finish), and made use of earlier ones via merge:

# program = block "." ;

# block = [ "const" ident "=" number {"," ident "=" number} ";"]
#         [ "var" ident {"," ident} ";"]
#         { "procedure" ident ";" block ";" } statement ;

# statement = [ ident ":=" expression | "call" ident 
#               | "?" ident | "!" expression 
#               | "begin" statement {";" statement } "end" 
#               | "if" condition "then" statement 
#               | "while" condition "do" statement ];

# condition = "odd" expression |
#             expression…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Geo-7
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by Geo-7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants