Page 1 of 1

In this project, you are going to develop a mini compiler for an animal language. You can pick an animal you want. This

Posted: Sat Nov 27, 2021 2:26 pm
by answerhappygod
In this project, you are going to develop a mini compiler for an
animal language. You can pick an animal you want. This animal
programming language will allow one to express
expressions/statements that the animal will utter. For example:
This is a BNF for a Sheep Language that will utter sentences like
“ba”, “baa”, “baaaaa”, etc  ba | ba  a | a This compiler would
only perform lexical analysis, and syntax analysis. Semantic
analysis is not required. You need to be imaginative on the kind of
tokens and expressions/statements the programming language can
support that will mimic the animal utterance or even you can be
imaginative like how cartoon animal characters “speak/utter”. These
are the tasks you have to perform. 1. Identify tokens in the animal
language. And build a DFA for the tokens. 2. Design the animal
language syntax (use BNF notations). Make sure the animal language
has got 4 to 5 non-terminals (for example, in the Sheep language
above we have 2 non-terminals - sheep_talk and sheep_noise). Use
your imagination to craft the terminals and the non-terminals
required in your animal language. Please refrain from complicating
your animal language with too many non-terminals (4 to 5
non-terminals is sufficient). 3. Build a parse table to perform
syntax analysis (you can choose to do top-down parsing or bottom-up
parsing) 4. Build a program that performs lexical and syntax
analysis. You may use tools taught in the course or do from
scratch. Test your program such that it accepts all valid language
and give compilation errors for the invalid ones. The program must
be able to show the output of a lexical analysis, and separately
show the output of a syntax analysis, and finally show the combined
result of lexical and syntax analysis. When designing and building
the program, it must be methodological as taught in the lectures of
this course (do not use any methods not taught in the course). The
methodology used must be documented and justified.