Grades and deadlines

YAML file to complete

Download the file lab2.1 and fill it in as you complete the tasks for the lab.

Task 1: Language Design

Ground rules

As before, source code should be plaintext using ASCII printable characters, space, and newline.

Your language may build off one or more of the languages from the previous unit, but it doesn’t need to do so. In particular, you can change anything about how those languages work if you want to, or you can start with something completely different. In either case, you need to include the complete specs for your new language in what you turn in for this lab.

Your language must be original and unique. It must have its own name and should not look and/or work quite the same as any other language.

Required capabilities

Your language needs to support all of the things from the previous unit:

Additionally, your language must also support:

Tips

There is some syntax to figure out with boolean literals and the new operations, but you should be comfortable doing that already from previous weeks.

The really new things are variables and having two different types. Think about how you want to handle that in your language!

All of this is up to you, and we expect to see a lot of different choices explored in what you turn in. (Ideas not listed above are also welcome!)

REQUIREMENTS

Fill in the language_name field in your YAML file with a name you choose for your programming language.

There is nothing else really to turn in for this part. But you should be sketching out ideas, writing small programs, starting to figure out what works and what doesn’t, as you narrow in on how your language will look and work.

To receive credit for this lab, your language needs to:

Task 2: Example program

Write an example program that demonstrates all features of your language. Include input/output test cases that indicate the program is running correctly.

REQUIREMENTS

Fill in the complete source code (along with comments) under the example_program field in your YAML file.

Fill in your test cases under example_input_1, example_output_1, etc.

Your example program must:

Task 3: Scanner specification

Now let’s start specifying the syntax of your language.

Give a table of token names (like STRLIT or ID or BOOLLIT) and corresponding regexes for all of the possible tokens in your language.

The list should be in order of highest to lowest precedence tokens. Regular expressions should use Java syntax.

Use the token name -- for regexes that should be ignored (like comments and whitespace).

REQUIREMENTS

Fill in the rest of the table in the tokens field of your YAML file.

Your tokens must:

Task 4: Parser specification

Complete the syntax spec for your language by providing a context-free grammar (CFG) for your language.

Use the token names from the token spec that you just wrote above. Each token name should be all caps and will constitute the terminal symbols in your grammar.

The nonterminals in your grammar should be written in lower case. The first nonterminal will be treated as the start symbol, which will be the root node of any correct parse tree for your language covering the complete program.

REQUIREMENTS

Fill in the grammar field of your YAML file with CFG production rules.

Your grammar must:

Task 5: Semantics specification

Indicate the meaning of any syntactically valid program in your language, answering questions such as:

You can assume we all know what “string concatenation”, “reversal”, “lexicographical comparison”, etc., all mean. The question here is to connect the parts of your syntax with these meanings.

REQUIREMENTS

Fill in the semantics field of your YAML file with a specification of the language semantics, connecting the required capabilities to syntax in your particular language.

Your semantics spec must:

Task 6: Peer review

Everyone must be designated as the “final reviewer” of exactly one other student in your section. The easiest way to do this is to form groups of 2 and 3 and do the reviews in a “circle” within that group.

When reviewing someone’s spec, you should probably try writing a small program in that spec and see if it makes sense. Think hard about edge cases or ambiguities.

By indicating Y that your spec has passed “final review”, you are saying that the version you are turning in has been successfully reviewed and the reviewer agrees it covers all the requirements with no ambiguities or UB.

REQUIREMENTS

Fill in the last four questions in your YAML file, indicating whose spec you have or will review, who has reviewed your spec, and a clear Y or N indicating whether the reviewer agrees that the version you are turning in satisfies all the requirements of the language and is clearly presented.