CS 315
Project 1


Assigned: Oct. 6, 2025
Due: Oct. 18, 2025, 23:59

Domain-Specific Language for Warehouse Robots & Its Lexical Analyzer

This semester's projects are about the design of a new language that is limited to programming warehause robots.

Language Overview. You will design a DSL for controlling autonomous warehouse robots on a 2D grid. The DSL must express navigation, scanning, and item-handling actions in a clear and reliable way.

Warehouse Model & Assumptions

Required Built-ins (Reserved Identifiers)

The first part of the project is about the design of the language and the implementation of its lexical analyzer.

Part A - Language Design (30 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 with its grammar in the BNF (not EBNF) form, followed by a description of each of your language components. The following is a list of minimal features that are required in your language:

You are encouraged to use your imagination to extend the list given above.

Discuss any other features of your language that you think is important.

Do not panic! You will have a chance to do minor revisions to 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 :)

Part B - Lexical Analyzer (40 points)

Having designed the language, 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 (a - b) x <- 7.5 ; display "OK" x ;

the lexical analyzer should produce the output similar to the following:

IF LP IDENTIFIER OP IDENTIFIER RP IDENTIFIER ASSIGN CONST SC DISPLAY STR IDENTIFIER SC

For conditional statements, such as if, you may follow the convention in the C language, that is, the value 0 is considered to be false and any non-zero value is considered to be true.

Part C - Example Programs (30 points)

Finally, you will prepare 3 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. Additional to your test programs, write the programs for the following two programs given as pseudo-code:

Program 1: Search by Item ID: traverse the grid, use scan() to find a target item ID on a tote, and stop when found.

Program 2: Carry Task: pick the specific item from its tote in a source cell and carry it either to another empty floor cell or onto the conveyor belt (when adjacent). Make sure your lex implementation correctly identifies all the tokens. The TA will test your lexical analyzer with these example programs along with other programs written in your language.

The test programs must be fully commented.

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.

Teams

The project will be implemented in teams of two or three students. The members of the teams will be the same for this and the next project, in which you will write a parser for your programming language. Note that all members of a team will get the same grade in this part. We will assume each member has contributed to the project equally.

Submission

Resources

Good Luck! - Have fun.