wiki
INF225 Fall 2021
Code from lectures
Example code and notes from lectures will appear here.
- 2021-09-15:
- Expression grammar with associativity/precedence coded as non-terminals: Expr.g4
- Example with parse tree visualization (run WebApp, then open http://localhost:4567/ in your browser – remember to stop and restart the app if you change something (if it's running in the background, you can still find it in Eclipse's debug view))
- ToXML.java – traverse ANTLR parse tree (any parse tree, generically) and produce XML to display in the browser
- 2021-09-13: Expr.rsc
- 2021-09-15: parsetrees
- 2021-10-04: Eval3.rsc (functions with dynamic scoping), Eval4.rsc (functions with lexical scoping)
- 2021-10-11: Expr.rsc, Eval5.rsc (with statements/declarations); Eval6.rsc (typechecker)
Example Projects
You can use these as a starting point for experiments.
Exercises
- Exercise 1
- Exercise 1½
- Exercise 1⅝
- Se på https://www.json.org/json-en.html
- Lag en grammatikk i Rascal eller ANTLR4 for JSON, eller
- Implementer en parser for JSON for hånd i f.eks. Python eller Java
- Exercise 2
- Exercise 3 – Python bytecode
Previous year's exercises
Notes
- Grammars
- Typechecking
- Concrete Types
- Environments
- Visitors and pattern matching (see also short lecture at Mitt UiB)
- A silly and not-so-silly LR parser
The PDF notes contains more carefully written notes from previous years, primarily from a Rascal perspective.