Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • shchen/cs320
  • raveendr/cs320
  • mwojnaro/cs320
3 results
Show changes
Commits on Source (344)
Showing
with 137 additions and 44 deletions
# EPFL CS320 - Computer language processing, 2021
# EPFL CS320 - Computer language processing, Spring 2025
**Implement a programming language!** All project based.
Links: [Moodle](https://moodle.epfl.ch/course/view.php?id=4241) and [Course Description](https://edu.epfl.ch/coursebook/en/computer-language-processing-CS-320)
This repository is the website for EPFL Course CS320, Computer languge processing.
Important information:
Please check here regularly for course updates.
* Midterm exam will take place Friday 4 April within the time block 13:00-17:00 in two rooms: [ELA 2](https://plan.epfl.ch/?room==ELA%202) and [CM 1 120](https://plan.epfl.ch/?room==CM%201%20120). One reminder sheet (2 sided) will be allowed.
* Please register for project groups on Moodle as soon as this is possible ([Registration link](https://moodle.epfl.ch/mod/choicegroup/view.php?id=1282182))
## Grading
The entire grade is based on project work, which, however, has many aspects: the implementation in [Scala](https://www.scala-lang.org/), a written report, oral presentation, and answers to questions, in presentation and throughout the semester. There will be no written exam.
The grade is based on a midterm (30%) as well as team project work (70%). Please read the [grading policy page](info/grading.md).
## Staff
## Schedule and Materials - Past Weeks
| Role | People |
| :--- | :--- |
| Professors | [Viktor Kunčak](https://people.epfl.ch/viktor.kuncak), [Self-Introduction](https://tube.switch.ch/videos/82f0eb14) |
| Head PhD TA | [Rodrigo Raya](https://people.epfl.ch/rodrigo.raya/)
| PhD TA | [Fereshte Mozafari](https://people.epfl.ch/fereshte.mozafari) |
| Student TAs | to be completed |
| Week | Labs | Day | Date | Time | Room | Topic | Materials
| :-- | :-- | :-- | :-- | :-- | :-- | :-- | :--
| 1 | | Wed | 19.02.2025 | 13:15 | BC 01 | Lecture 1 | [Intro to CLP](https://mediaspace.epfl.ch/media/01-01%2C+Intro+to+Computer+Language+Processing/0_okro5h0v) [(PDF)](info/lectures/lec01a.pdf), [Formal languages](https://mediaspace.epfl.ch/media/01-02%2C+Formal+Languages/0_segfj94w) [(PDF)](info/lectures/lec01b.pdf) |
| | | Fri | 21.02.2025 | 13:15 | ELA 2 | Lecture 2 | [Operations on Formal Languages](https://mediaspace.epfl.ch/media/02-01%2C+Operations+on+Formal+Languages/0_otyeghg6), [Regular Expressions and Idea of a Lexer](https://mediaspace.epfl.ch/media/02-02%2C+Regular+Expressions+and+Lexer+Idea/0_th59v9kx) [(PDF)](info/lectures/lec02.pdf) |
| | 1.... | Fri | 21.02.2025 | 15:15 | ELA 2 | Lab 1 | [Interpreter lab released (due in 2 weeks)](./info/labs/lab01/) |
| 2 | 1.... | Wed | 26.02.2025 | 13:15 | BC 01 | Lecture 3 | [First Symbols. Constructing a Lexer](https://mediaspace.epfl.ch/media/03-01%2C+First+Symbols.+Constructing+a+Lexer/0_a943fw0n) [(PDF)](info/lectures/lec03a.pdf), [From Regular Expressions to Automata](https://mediaspace.epfl.ch/media/03-02%2C+From+Regular+Expressions+to+Automata/0_icjqhfj0) [(PDF)](info/lectures/lec03b.pdf) |
| | 1..... | Fri | 28.02.2025 | 13:15 | ELA 2 | Exercise 1 | [Languages, Automata and Lexers](info/exercises/ex-01.pdf) |
| | 12.... | Fri | 28.02.2025 | 15:15 | ELA 2 | Lab 2 | Lexer lab release |
| 3 | 12.... | Wed | 05.03.2025 | 13:15 | BC 01 | Lecture 4 | [Introduction to Grammars](https://mediaspace.epfl.ch/media/04-01%2C+Introduction+to+Grammars/0_krhjbo09) [(PDF)](info/lectures/lec04-grammars-intro.pdf), [Syntax Trees](https://mediaspace.epfl.ch/media/04-02%2C+Syntax+Trees/0_9h4g5k1c) [(PDF)](info/lectures/lec04-trees.pdf)
| | 12.... | Fri | 07.03.2025 | 13:15 | ELA 2 | Exercises 2 | [Grammar Concepts](info/exercises/ex-02.pdf) [(solutions)](info/exercises/ex-02-sol.pdf) |
| | 123... | Fri | 07.03.2025 | 15:15 | ELA 2 | Lab 3 | [Parser lab](info/labs/lab03/) release |
| 4 | .23... | Wed | 12.03.2025 | 13:15 | BC 01 | Lecture 5 | [LL(1) Parsing](https://mediaspace.epfl.ch/media/04-03%2C+LL%281%29+Parsing/0_se2zd8kt) [(PDF)](info/lectures/lec05-ll1.pdf). [Scallion Tutorial](https://mediaspace.epfl.ch/media/04-10%2C+Scallion+tutorial/0_lypn7l0x) |
| | .23... | Fri | 14.03.2025 | 13:15 | ELA 2 | Lecture 6 | [Name Analysis](https://mediaspace.epfl.ch/media/06-01%2C+Name+Analysis/0_1b9t1hz8) [(PDF)](info/lectures/lec06-name-analysis.pdf), [Type Systems as Inductive Relations](https://mediaspace.epfl.ch/media/07-01%2C+Introduction+to+Types+and+Inductive+Relations/0_3hxblocu) [(PDF)](info/lectures/lec06-inductive.pdf) . [Operational Semantics](https://mediaspace.epfl.ch/media/07-02%2C+Operational+Semantics/0_3ru05nbo) [(PDF)](info/lectures/lec06-operational.pdf) |
| | .23... | Fri | 14.03.2025 | 15:15 | ELA 2 | Lab 3 | [Parser lab](info/labs/lab03/) |
| 5 | ..3... | Wed | 19.03.2025 | 13:15 | BC 01 | Exercises 3 | [LL(1) Grammars](info/exercises/ex-03.pdf) [(solutions)](info/exercises/ex-03-sol.pdf) |
| | ..3... | Fri | 21.03.2025 | 13:15 | ELA 2 | Lecture 7 | [Type Checking](https://mediaspace.epfl.ch/media/07-03%2C+Type+Rules%2C+Progress%2C+Preservation/0_znlmwvlt) [(PDF)](info/lectures/lec07-soundness.pdf), [Type Inference](https://mediaspace.epfl.ch/media/08-01%2C+Type+Inference/0_txnn92oh) [(PDF)](info/lectures/lec07-inference.pdf) |
| | ..34.. | Fri | 21.03.2025 | 15:15 | ELA 2 | Lab 4 | [Typer lab](info/labs/lab04/) release |
| 6 | ..34.. | Wed | 26.03.2025 | 13:15 | BC 01 | Exercises 4 | [Operational Semantics and Type Checking](info/exercises/ex-04.pdf) [(solutions)](info/exercises/ex-04-sol.pdf) |
| | ..34.. | Fri | 28.03.2025 | 13:15 | ELA 2 | Lecture 8 | Finish [Type Inference](https://mediaspace.epfl.ch/media/08-01%2C+Type+Inference/0_txnn92oh) [(PDF)](info/lectures/lec07-inference.pdf). Start [Code generation: Examples and Web Assembly](https://mediaspace.epfl.ch/media/09-01%2C+Code+GenerationA+Examples%2C+WebAssembly/0_xowt7e6w) [(PDF)](info/lectures/lec08-codegen.pdf) [Compiling Expressions](https://mediaspace.epfl.ch/media/09-02%2C+Compiling+Expressions/0_33e91bye) [(PDF)](info/lectures/lec08-codegen-postfix.pdf) |
| | ..34.. | Fri | 28.03.2025 | 15:15 | ELA 2 | Lab 4 | [Typer lab](info/labs/lab04/) |
| 7 | ...4.. | Wed | 02.04.2025 | 13:15 | BC 01 | Exercises 5 | [Type checking and more](info/exercises/ex-05.pdf) [(solutions)](info/exercises/ex-05-sol.pdf); [Review exercises](info/exercises/ex-review.pdf) [(solutions)](info/exercises/ex-review-sol.pdf)|
| | ...4.. | Fri | 04.04.2025 | 13:15 | ELA+CM | **EXAM** | |
| | ...4.. | Fri | 04.04.2025 | 15:15 | ELA+CM | **EXAM** | |
## Schedule and material
## Schedule and Materials - Current
Monday slots will typically focus on lecture materials. The remaining slots will focus on labs, **except for the first week's Wednesday and Thursday** when we will have lectures to get basic understanding of the metarial. We will provide an online version of the activity as well. So far, as long as there is demand, the plan is to also be present in the physical room, as scheduled.
| Week | Labs | Day | Date | Time | Room | Topic | Materials |
| :-- | :-- | :-- | :-- | :-- | :-- | :-- | :-- |
| | | | | | | |
| 8 | ...45. | Wed | 09.04.2025 | 13:15 | BC 01 | Lab 5 | [Solutions](info/past-exams/2025/exam2025-solutions.pdf) of last week's [Exam](info/past-exams/2025/exam2025-with-points.pdf). [Codegen lab description](info/labs/lab05/lab05-README.md) |
| | ...45. | Fri | 11.04.2025 | 13:15 | ELA 2 | Lecture 9 | [Simple Code Generation for If](https://mediaspace.epfl.ch/media/09-03%2C+Simple+Code+Generation+for+if+/0_wnn3dyxk), [Translating Control with Destination Parameters](https://mediaspace.epfl.ch/media/10-01%2C+Translating+Control+with+Destination+Parameters/0_d6vyszy4) |
| | ...45. | Fri | 11.04.2025 | 15:15 | ELA 2 | Lab 5 | [Lab 05](info/labs/lab05/) |
| | | | | | | |
| 9 | ....56 | Wed | 16.04.2025 | 13:15 | BC 01 | Lab 5 | Codegen lab. Pick projects |
| | | Fri | 18.04.2025 | 13:15 | ELA 2 | **HOLIDAY** | |
| | | Fri | 18.04.2025 | 15:15 | ELA 2 | **HOLIDAY** | |
| | | | | | | |
| - | | Wed | 23.04.2025 | | | **BREAK** | |
| | | Fri | 25.04.2025 | | | **BREAK** | |
| | | Fri | 25.04.2025 | | | **BREAK** | |
| | | | | | | |
| 10 | ....56 | Wed | 30.04.2025 | 13:15 | BC 01 | Labs | **Oral Lab Checks** |
| | ....56 | Fri | 02.05.2025 | 13:15 | ELA 2 | Labs | **Oral Lab Checks** |
| | ....56 | Fri | 02.05.2025 | 15:15 | ELA 2 | Lecture 10 | Parsing general grammars |
| | | | | | | |
| 11 | .....6 | Wed | 07.05.2025 | 13:15 | BC 01 | Lecture 11 | Compiler correctness |
| | .....6 | Fri | 09.05.2025 | 13:15 | ELA 2 | Labs | |
| | .....6 | Fri | 09.05.2025 | 15:15 | ELA 2 | Labs | |
| | | | | | | |
| 12 | .....6 | Wed | 14.05.2025 | 13:15 | BC 01 | Labs | |
| | .....6 | Fri | 16.05.2025 | 13:15 | ELA 2 | Labs | |
| | .....6 | Fri | 16.05.2025 | 15:15 | ELA 2 | Labs | |
| | | | | | | |
| 13 | .....6 | Wed | 21.05.2025 | 13:15 | BC 01 | | Project presentations |
| | .....6 | Fri | 23.05.2025 | 13:15 | ELA 2 | | Project presentations |
| | .....6 | Fri | 23.05.2025 | 15:15 | ELA 2 | | Project presentations |
| | | | | | | |
| 14 | .....6 | Wed | 28.05.2025 | 13:15 | BC 01 | | Project presentations |
| | .....6 | Fri | 30.05.2025 | 13:15 | ELA 2 | | Project presentations |
| | .....6 | Fri | 30.05.2025 | 15:15 | ELA 2 | | Project presentations |
The material we cover will be similar to [last year](https://lara.epfl.ch/w/cc20/top).
## Books
Note that slides can be found underneath each lecture video on switch tube linkes below.
[Printed and online books](info/books.md) can be helpful, even if our goal is for lectures, exercises, and project instructions to be self-contained.
## Staff
| Week | Day | Date | Topic | Videos & Slides |
| :-- | :-- | :-- | :-- | :-- |
| 1 | Wed | 22.09.2021 | Lecture 1 | [Intro to CLP](https://tube.switch.ch/videos/3351ec99), [Formal languages](https://tube.switch.ch/videos/6df3a6ba) |
| | Thu | 23.09.2021 | Lecture 2 | [Operations on Languages](https://tube.switch.ch/videos/1846c6f2), [Regular Expressions and Lexers](https://tube.switch.ch/videos/a15b1c5f) |
| | | | Labs 0 | [Labs setup](https://gitlab.epfl.ch/lara/cs320/-/blob/main/labs_setup.md) | |
| | |
|:----------|:----------------------------------------------------------------|
| Professor | [Viktor Kunčak](https://people.epfl.ch/viktor.kuncak) |
| PhD TA | [Samuel Chassot](https://people.epfl.ch/samuel.chassot) |
| PhD TA | [Sankalp Gambhir](https://people.epfl.ch/sankalp.gambhir) |
| MSc TA | [Sidonie Bouthors](https://people.epfl.ch/sidonie.bouthors) |
| MSc TA | [Sébastien Kobler](https://people.epfl.ch/sebastien.kobler) |
| MSc TA | [Marcin Wojnarowski](https://people.epfl.ch/marcin.wojnarowski) |
| MSc TA | [Jacopo Moretti](https://people.epfl.ch/jacopo.moretti/) |
====== The Amy Reference Compiler ======
We provide you with a reference compiler for the Amy language that you can use to explore the expected behavior of your own compiler.
The reference compiler is [[http://lara.epfl.ch/~gschmid/clp20/amyc_2.12-1.7.jar|available here]].
You can run it as follows:
java -cp amyc_2.12-1.7.jar amyc.Main [options] [input files]
To see the list of available options do
java -cp amyc_2.12-1.7.jar amyc.Main --help
The easiest way to execute a program is to run it in ''-''''-interpret'' mode. If you want to generate WebAssembly binary code, you should follow these steps:
* Install ''nodejs''. We have tested amyc with Node version 12, though other versions might work. See the [[https://nodejs.org/en/|Node website]] for installation instructions.
* Make sure the ''wat2wasm'' executable is visible, i.e., it is in the system path or, for Linux or Mac, you are at the toplevel of the ''amyc'' directory.
* Run ''npm install deasync'' in the directory you plan to run ''amyc''.
* Run ''amyc'' without options. You will get a few output files.
* Run ''nodejs <output file>.js''
===== Bug Reports =====
We welcome bug reports! Please use the forum on Moodle for this purpose.
\ No newline at end of file
# Selected Books for Computer Language Processing
The following books contain overlapping material with some recommendations for most relevant parts:
* [Modern compiler implementation in ML](http://library.epfl.ch/en/beast?isbn=9781107266391). Read Sections 2.1-2.4 for Lexical analysis, Sections 3.1-3.2 for parsing, and 5.3-5.4 as well as 16.1-16.3 for type checking
* [Introduction to automata theory, languages, and computation](https://epfl.swisscovery.slsp.ch/permalink/41SLSP_EPF/1g1fbol/alma990053993040205516) (3rd Ed.) by Hopcroft, Motwani, Ullman, 2007. First seven chapters are an excellent way to get in-depth understanding of finite automata and context-free grammars. If you need to pick, read sections 2.2, 2.3, 2.5, 3.1, 3.2.3, 4.1, 5.1, 5.2
* [Discrete Mathematics and Its Applications by Kenneth H. Rosen (8th edition)](https://epfl.swisscovery.slsp.ch/discovery/fulldisplay?docid=alma99116968862405516&context=L&vid=41SLSP_EPF:prod&lang=en&search_scope=MyInst_and_CI&adaptor=Local%20Search%20Engine&tab=41SLSP_EPF_MyInst_and_CI&query=any,contains,Discrete%20Mathematics%20and%20Its%20Applications&sortby=date_d&facet=frbrgroupid,include,9018235242682604086&offset=0), available in the library and you may have it already. Useful backround is in sections 1.7, 1.8, 2.1, 2.2, 5.1, 5.3, 9.1, 9.2, 13.1, 13.3, 13.4
* [Basics of Compiler Design](http://hjemmesider.diku.dk/~torbenm/Basics/). Online! Read pages 9-88 (omit Section 2.8) for lexical analysis and parsing
* [Compilers, principle, techniques and tools](http://library.epfl.ch/en/beast?isbn=9781292024349)
.PHONY = all clean
OUT_DIR ?= $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
DIRS := $(wildcard src/ex-??)
EXPDFS := $(patsubst src/ex-%,ex-%.pdf,$(DIRS))
SOLPDFS := $(patsubst src/ex-%,ex-%-sol.pdf,$(DIRS))
TEXARGS := -shell-escape -interaction=batchmode
all: $(EXPDFS) $(SOLPDFS)
ex-%.pdf: src/ex-%/main.tex
cd src/ex-$* && \
lualatex $(TEXARGS) -jobname=ex-$* "\def\ANSWERS{0}\input{main.tex}" && \
cp ex-$*.pdf $(OUT_DIR)/ex-$*.pdf
ex-%-sol.pdf: src/ex-%/main.tex
cd src/ex-$* && \
lualatex $(TEXARGS) -jobname=ex-$*-sol "\def\ANSWERS{1}\input{main.tex}" && \
cp ex-$*-sol.pdf $(OUT_DIR)/ex-$*-sol.pdf
clean:
rm -f $(EXPDFS) $(SOLPDFS)
for d in $(DIRS); do \
pushd $$d && rm -f *.aux *.log *.out main.pdf; popd; \
done
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
# Past Exercises
This is the collection of the exercises used in previous iterations of the
course. They are here if you wish to try additional exercises, but note that not
everything may necessarily match the current content of the course.
File added
# Exercise sheet 1
For exercise session on 28 September
we propose to solve selected exercise from the textbook:
http://hjemmesider.diku.dk/~torbenm/Basics/
In particular, we propose the following ones:
* Exercise 2.1
* Exercise 2.2
* Exercise 2.7
* Exercise 2.11
* Exercise 2.16
Most of them already have solutions provided; we will
provide solution to 2.16. Please also check the discussion forum.
File added