Description
A Programming Language for Drones and its Lexical Analyzer
This semester’s projects are about the design of a new language for drones. Assume that you are working in the software department of a company that builds drones. The hardware department constructs drones that are equipped with
a gyroscope that detects the inclination of the drone, a barometer for measuring altitude and a thermometer that measures changes in temperature, an acceleration sensor. a video camera that can be turned on and off, or it can be used to take pictures.
The programs will be executed on the base computer, which will send the commands to the drone over the wi-fi connection. The interface with the hardware is given in the following SDK Note that this is a real drone available in the market. Instead of the python programming mentioned in the beginning of the User Guide, you will design a new language just for this drone.
Here are some sample videos about programming a drone:
https://www.youtube.com/watch?v=1yLYQOSWn9w https://www.youtube.com/watch?v=-M7dCeb6fMY https://www.youtube.com/watch?v=5NGPrMP1r2Y
https://www.aerial-guide.com/article/program-tello-drone-to-do-backflips-with-scratch A sample program in Scratch.
In this project, you are not asked to design and implement the user interface for a programming tool. You are asked to design a simple programming language and its parser only.
Part A – Language Design (40 points)
First, you will give a name to your language and design its syntax. Note that the best way to hand in your design is its grammar in BNF form, followed by a description of each of your language components. The following is a list of features required in your language:
variable identifiers assignment operator
precedence, associativity of the operators
expressions (arithmetic, relational, boolean, their combination) loops
conditional statements statements for input / output function definitions and function calls. comments
primitive functions for
reading the inclination of the drone reading the altitude reading the temperature reading the acceleration turning on/off video camera taking pictures with video camera reading current timestamp from timer connecting to the base computer through wi-fi
All of these features must be built-in your language. Do not assume importing from a library.
You are encouraged to use your imagination to extend the list given above.
Part B – Lexical Analysis (30 points)
In the second part of this project, you will design and implement a lexical analyzer for your language, using the lex tool available on Unix style systems. Your scanner should read its input stream and output a sequence of tokens corresponding to the lexemes defined in your language. Since at this stage you will not be able to connect the output to a parser, your scanner will print the names of the tokens on the screen. For instance, if we were designing a C like syntax, for the input
if ( answer == 2 ) { …
the lexical analyzer should produce an output, similar to the following:
IF LP IDENTIFIER EQUAL_OP NUMBER RP LBRACE …
Part C – Example Programs (30 points)
Do not panic! You are not required to write an interpreter or compiler for this language. Just write a few programs in the language you designed and make sure that the lexical analyzer produces the right sequence of tokens.
Groups
The project can be implemented in groups of two or three students. The members of the groups will be the same for both parts of the project, this and the next. The members of a group can be from different sections.
Submission
There are several parts that you will hand in.
1. A project report including the following components:
Name, ID and section for all of the project group members. The name of your language.
The complete BNF description of your language.
One paragraph explanation for each language construct (i.e. nonterminals) detailing their intended usage and meaning, as well as all of the associated conventions. Descriptions of how nontrivial tokens (comments, identifiers, literals, reserved words, etc) are defined in your language. For all of these, explain what your motivations and constraints were and how they relate to various language criteria such as readability, writability, reliability, etc.
Evaluate your language in terms of
a. Readability
b. Writability
c. Reliability
2. The lex description file.
3. Example programs, written in your language. These example programs should bemeaningful.
Resources
Running lex and yacc on Linux systems (accessible in Bilkent Campus)
The Lex & Yacc Page (dinosaur.compilertools.net)
Discrete Mathematics – Sets
Good Luck! – Have fun.




Reviews
There are no reviews yet.