In this assignment you will demonstrate:
Although your team will be turning in only one submission, every team member is individually responsible for each of the following:
All homework in this class is to be done in your three to six-person group. DO NOT “partition” the work. Letting a team member do some problems while you do others cheapens your educational experience and leaves you behind. It is best for each student to do all of the problems, then meet as a group to (1) select the “best” answer for submission when more than one exist, and (2) teach each other. If one group member is unable to do one of the problems, another group member can teach that student how it do it. Everyone is responsible for understanding the entire homework submission, so everyone should contribute to the entire assignment.
Select one student to upload the single submission for the entire team.
Your team's BrightSpace submission should be an attached PDF or text file with:
Add me as a committer to your repository. My github name is rtoal. This will help me help you during office hours if your project seems to be flailing.
Solutions to these problems will appear in the beautifully formatted PDF that you will submit to BrightSpace. For problems involving code to write, host your code on GitHub or Replit or OneCompiler (or similar) and provide the link to the hosting site in your BrightSpace submission.
let [x, y] = [0, 0]; console.log(93.8 * 2 ** x + y);
import x from "x" console.log(93.8 * {x} << x.r[z])
Program
node; give only the AST for the expression.
x / {[x]: `${x}`}[x]
class C { f({a}) {return ([a,f]) => C} }
Exp
, Term
, Factor
, and Primary
that make the expression -2**2
:
(-2)**2
and -(2**2)
to be legal.while
, followed by a test expression, followed by a block (a curly-brace delimited sequence of statements). The if-statement should start with the keyword if
, followed by a test expression, then a block, then an optional else-part which is the keyword else
followed by either a block or another if-statement. Neither the while statement nor the if statement should end with a semicolon. The break statement is only allowed to appear in a while statement’s block. The relational operators are the same as those in Python and are to be NON-associative. All of the relational operators are on the same precedence level, lower than all other operators. Give the syntax of Astro++ using Ohm.
In this class you will not only be writing a compiler—you will be writing a compiler for a language that you design yourself. You have wide latitude in designing your language: I want you to design a language you can actually love. The only requirements are: (1) it must be of sufficient complexity (i.e., enough interesting features, including features beyond the example languages we see in class), and (2) it requires significant work in the static analysis phase. You can satisfy the latter requirement with a statically-typed language with static scoping (in addition to a few other checks of course), but it may be possible to design a dynamically typed language, provided you define a significant number of statically checked contextual constraints. If you go with a dynamically-typed language, you should check with me first to make sure your workload is fair.
Complete the first pass of the design of your language. USE THE OHM EDITOR. Give your language description on the README.md file of a public GitHub repository you will be setting up for the project. You should have, in your README:
A list of previous projects from students that have taken this class over the last decade or so can be found in the Course Notes on Language Design. You may find these helpful, but do beware that some of them may be lacking in some areas.
"type": "module"
to allow for modern JavaScript. Ensure that npm test
runs tests. For now, just fill the examples folder with a lot of example programs. You don’t have to start writing the compiler, but since you want to make sure your project does something, make your main file simply print “Hello, world” or something silly or fun (just not the script to the Bee Movie or a link to Never gonna... oh n/m you know what mean, be more creative). Your test program needs at least one test, it can be as simple as testing that 1 = 1.
.
├── .gitignore
├── README.md
├── LICENSE
├── package.json -- configuration because this is a Node.js app
├── .prettierrc.json -- (optional, you don’t have to have one)
├── docs
│ └── logo.png
├── examples
│ └── ... -- sample code is nice to have here!
├── src
│ └── (yourlangname).js -- Can just say console.log("Hello world")
for now
└── test
└── compiler.test.js -- Can just assert 1===1 for now
To help you get a good score, here are all the things you will be graded on.