2 — Bare Bones: Parser
Due Thursday, 18 September 2025, 11:59:59pm
Purpose to build a basic parser A proper understanding of parsing requires a full-fledged course.
Delivery Deliver your solutions in a directory called 2 within your assigned GitHub repository. The directory should contain the following items:
the executables xparse as specified in the testing task below;
the sub-directory 2/Tests/ with the required integration test; and
an optional sub-directory called 2/Other/ for all auxiliary files.
Programming Task You are to design an AST data representation for Bare Bones. Using your favorite language, implement a parser that consumes a ExampleBB expression and determines whether it belongs to Bare Bones.
ExampleBB is an Example whose Names also contain the following keywords: if0, while0, block, =, /, +, ==.
See figure 1, which specifies the grammar of the language as a subset of ExampleBB.
Program ::= (Statement^* Expression)
Statement ::= (Variable = Expression)
| (if0 Expression Block Block)
| (while0 Expression Block)
Block ::= Statement
| (block Statement^+)
Expression ::= GoodNumber
| Variable
| (Variable + Variable)
| (Variable / Variable)
| (Variable == Variable)
The set of Variables consists of all Names, minus keywords.
The set of GoodNumbers comprises all inexact numbers
(doubles) between -1000.0 and +1000.0, inclusive.
You may assume that the input is always an instance of ExampleBB.
Testing Task Create 5 integration tests for xparse.
A test always consists of inputs, expected
output, and an automated procedure for comparing the actual output
with the expected one. —
Readings Syntax and Parsing