+/EE379K
programming paradigms
git clone https://git.julia.blue/+/EE379K
5a7dde3
master
files
| test/good/ | |
| Ident.java | 218 B |
| InvalidProgramException.java | 142 B |
| MyNode.java | 672 B |
| README.md | 1.0 KiB |
| Visitor.java | 7.2 KiB |
| build.sh | 483 B |
| lexparse.jjt | 3.9 KiB |
| lexparse.txt | 4.8 KiB |
Building instructions
Running ./build.sh will produce lexparse.jar which will accept code on STDIN.
Assumptions
- Enums, methods, classes, constants, and variables at the top level all share the same namespace.
- The program name ("program Foo ...") is not in a shared namespace with anything else.
- The unicode minus signs in the given example were meant to be ascii
- The "constint" in the given example is meant to be "const int"
thisis handled specially in that it is not a keyword, but we don't have to verify that it's been defined before being used like other identifiers.- We don't have to write a type checker. For example if a class
Foohas a methodbar()that returns an object of typeBaz, and the program contains a variablexof typeFoo, we can't distinguish ifx.bar().quack()is valid because we'd have to know the return type ofbar()and look at the declared methods ofBaz. In general this means that while we can resolve whether or not a name has been defined, we can't actually check their usages correctly.