This semester's project is 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 the following:
Drone for Agricultural Spraying.* | Traversing the whole field.** |
* https://www.morningagclips.com/using-drones-for-spray-application-adoption-trends-in-us-and-worldwide/ ** https://www.mdpi.com/2226-4310/10/9/755 |
Your team is asked to design a special purpose Programming Language to program the drones produced by the hardware department. People who purchase these drones may not be computer engineers; so it is important that the programming language is readable, writable and reliable. This newly designed language should be similar to the classical imperative languages, since the users are assumed to have taken a basic programming course in college.
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 that are required in your language:
All of these features must be built-in in your language. Do not assume importing from a library.
You are encouraged to use your imagination to extend the list given above.
You will have a chance to do minor revisions on your syntax design for Project 2, later in the semester. Language designs are almost never exactly right in the first iteration. Just try your best to make it as readable/writable/reliable as you can and keep your eyes open for what does and what does not work :)
In this part of this project, you will design and implement a lexical analyzer for your language, using the lex tool available on all Unix style systems. Your scanner should read its input stream and output a sequence of tokens corresponding to the lexemes you will define 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 ( temp > 35 ) { ...
the lexical analyzer should produce the output
IF LP IDENTIFIER GR_EQ NUMBER RP LBRACE ...
Finally, you will prepare at least 4 test programs of your choice that exercise all of the language constructs in your language, including the ones that you may have defined in addition to the required list given above. Be creative, and have some fun.
Your test programs should include the following two. So, you add two more test programs.
Test #1:
Define a function that takes two parameters, that are heading and distance. This function will turn the drone to the given heading and move it forward to the given distance.
Test #2:
Write a program so that the drone sprays the pesticides in its tank along the dashed blue line over the field, marked as the solid black lines, in the following figure. The drone will start on the ground at the red marked origin and will return to the same point. While spraying, the drone should be 4 meters above the ground. You can determine the dimensions of the field and the distance between the field border and spraying line. Use the function that you defined Test #1 in this test program.
Make sure your lex implementation correctly identifies all the tokens. The TA will test your lexical analyzer with these example programs along with different programs written in your language.
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.
dijkstra.cs.bilkent.edu.tr
.
The TA will test your project on the dijkstra machine,
and any project that does not compile or run on this machine will get 0 on Part-B.