diff options
Merge branch '2020/intro'
13 files changed, 141 insertions, 12 deletions
| -rw-r--r-- | website/content/post/2018/midterm.md | 1 | ||||
| -rw-r--r-- | website/content/post/2018/midterm_results.md | 1 | ||||
| -rw-r--r-- | website/content/post/2018/project_presentation.md | 1 | ||||
| -rw-r--r-- | website/content/post/2018/projects.md | 1 | ||||
| -rw-r--r-- | website/content/post/2018/september.md | 1 | ||||
| -rw-r--r-- | website/content/post/contents.md | 3 | ||||
| -rw-r--r-- | website/content/post/dragons.md | 15 | ||||
| -rw-r--r-- | website/content/post/homeworks.md | 3 | ||||
| -rw-r--r-- | website/content/post/intro.md | 15 | ||||
| -rw-r--r-- | website/content/post/resources.md | 4 | ||||
| -rw-r--r-- | website/content/slides/00_intro/_index.md | 39 | ||||
| -rw-r--r-- | website/content/slides/01_dragons/_index.md | 67 | ||||
| -rw-r--r-- | website/data/menu.yaml | 2 |
diff --git a/website/content/post/2018/midterm.md b/website/content/post/2018/midterm.md index 879a1f6..f29a375 100644 --- a/website/content/post/2018/midterm.md +++ b/website/content/post/2018/midterm.md @@ -2,6 +2,7 @@ title: "Midterm Test 2018 edition" date: 2018-12-08T19:01:49+02:00 edition: 2018 +expiryDate: 2020-09-30 draft: false --- # diff --git a/website/content/post/2018/midterm_results.md b/website/content/post/2018/midterm_results.md index 64050e2..1d78e8e 100644 --- a/website/content/post/2018/midterm_results.md +++ b/website/content/post/2018/midterm_results.md @@ -2,6 +2,7 @@ title: "Midterm Test Results - 2018 edition" date: 2019-01-08T19:01:49+02:00 edition: 2018 +expiryDate: 2020-09-30 draft: false --- diff --git a/website/content/post/2018/project_presentation.md b/website/content/post/2018/project_presentation.md index 7325bc4..d8b4c94 100644 --- a/website/content/post/2018/project_presentation.md +++ b/website/content/post/2018/project_presentation.md @@ -2,6 +2,7 @@ title: "Project Presentations - 2018 edition" date: 2019-01-25T19:01:49+02:00 edition: 2018 +expiryDate: 2020-09-30 draft: false --- diff --git a/website/content/post/2018/projects.md b/website/content/post/2018/projects.md index 6fa6fa1..5499cde 100644 --- a/website/content/post/2018/projects.md +++ b/website/content/post/2018/projects.md @@ -2,6 +2,7 @@ title: "Projects - 2018 edition" date: 2019-01-09T19:01:49+02:00 edition: 2018 +expiryDate: 2020-09-30 draft: false --- diff --git a/website/content/post/2018/september.md b/website/content/post/2018/september.md index a881d3e..97b5d60 100644 --- a/website/content/post/2018/september.md +++ b/website/content/post/2018/september.md @@ -2,6 +2,7 @@ title: "September Session Exam 2018 edition" date: 2019-08-22T19:01:49+02:00 edition: 2018 +expiryDate: 2020-09-30 draft: false --- diff --git a/website/content/post/contents.md b/website/content/post/contents.md index cf5d446..cbdaf00 100644 --- a/website/content/post/contents.md +++ b/website/content/post/contents.md @@ -1,8 +1,9 @@ --- title: "Course Contents" date: 2018-08-02T17:45:53+03:00 -edition: 2018 draft: false +expiryDate: 2020-09-30 + --- Table of contents for the course. diff --git a/website/content/post/dragons.md b/website/content/post/dragons.md new file mode 100644 index 0000000..937885b --- /dev/null +++ b/website/content/post/dragons.md @@ -0,0 +1,15 @@ +--- +title: "Programming Languages, Compilers, Interpreters" +date: 2020-10-05 +draft: false +--- + +Overview of compiler and interpreter architecture. + +<!--more--> + +[Slideshow]({{< ref "/slides/01_dragons" >}}) + +--- + +{{% readpost file="/slides/01_dragons/_index.md" markdown=true %}} diff --git a/website/content/post/homeworks.md b/website/content/post/homeworks.md index a1fb2ab..18627e7 100644 --- a/website/content/post/homeworks.md +++ b/website/content/post/homeworks.md @@ -2,7 +2,8 @@ title: "Homeworks" date: 2018-11-17T19:01:49+02:00 draft: false -edition: 2018 +expiryDate: 2020-09-30 + --- # Virtual Machine and JSImpl related homeworks diff --git a/website/content/post/intro.md b/website/content/post/intro.md new file mode 100644 index 0000000..06c5fe6 --- /dev/null +++ b/website/content/post/intro.md @@ -0,0 +1,15 @@ +--- +title: "Introduction to IPL course" +date: 2020-10-04 +draft: false +--- + +Introduction to the Implementation of Programming Languages course + +<!--more--> + +[Slideshow]({{< ref "/slides/00_intro" >}}) + +--- + +{{% readpost file="/slides/00_intro/_index.md" markdown=true %}} diff --git a/website/content/post/resources.md b/website/content/post/resources.md index 4072002..cee1d64 100644 --- a/website/content/post/resources.md +++ b/website/content/post/resources.md @@ -1,8 +1,9 @@ --- title: "Resources" date: 2018-09-29T00:24:06+03:00 -edition: 2018 draft: false +expiryDate: 2020-09-30 + --- A general collection of resources on implementing programming languages and @@ -10,6 +11,7 @@ virtual machines. <!--more--> + ## General ### Courses diff --git a/website/content/slides/00_intro/_index.md b/website/content/slides/00_intro/_index.md index 0625219..9341dfb 100644 --- a/website/content/slides/00_intro/_index.md +++ b/website/content/slides/00_intro/_index.md @@ -65,6 +65,7 @@ We are going to study and enhance a JavaScript interpreter. - understandable - working - extensible +- embeddable --- ## How you are going to be graded? @@ -133,15 +134,16 @@ contribution. - Follow the pull request template - Add your faculty number in the description +--- ## What are the requirements? -1. {{< frag c="Will to learn and time to experiment and write code" >}} -2. {{< frag c="Programming with C++, fluent in C++ will be better" >}} -2. {{< frag c="Programming with JavaScript or other dynamic language" >}} -3. {{< frag c="Data structures" >}} -4. {{< frag c="Languages, Finite Automata, Computability" >}} -5. {{< frag c="How computers work - CPU, memory hierarchy, etc" >}} +1. Will to learn and time to experiment and write code +2. Programming with C++, fluent in C++ will be better +2. Programming with JavaScript or other dynamic language +3. Data structures +4. Languages, Finite Automata, Computability +5. How computers work - CPU, memory hierarchy, etc --- # Contents of the course @@ -182,6 +184,7 @@ Abstract Syntax Tree 1. How to grow one? 2. What to do with it? 3. Evaluating the syntax tree +4. Transforming the syntax tree {{% note %}} - language transformation at syntax level @@ -205,8 +208,10 @@ Virtual machines 1. What is a virtual machine? 2. Implementing the language features in the VM + - Library - arrays, hash maps, etc - OOP - Exception handling +3. Communicating with the "real" machine --- ## 7. GC @@ -228,6 +233,18 @@ Garbage collection 3. Ahead of Time --- +# Plan for the course + +1. Introduction - week 1 +2. Lexers - week 2 +3. Parser - week 2 +4. AST - week 3, 4 +5. Bytecode - weeks 5, 6 +6. VMs - weeks 7, 8, 10 +7. GC - weeks 10, 11 +8. JIT & AOT code generation - weeks 11, 12, 13 + +--- ## Resources - https://github.com/SofiaCPP/IPL @@ -237,4 +254,14 @@ Garbage collection - Links to resources will be there too! --- +## Resources + +Real world virtual machines: + +- V8, SpiderMonkey, JavaScriptCore, ChakraCore and many more +- duktape +- lua, luajit +- cPython, PyPy, ... + +--- # ? diff --git a/website/content/slides/01_dragons/_index.md b/website/content/slides/01_dragons/_index.md index 52ecf91..756066b 100644 --- a/website/content/slides/01_dragons/_index.md +++ b/website/content/slides/01_dragons/_index.md @@ -197,7 +197,26 @@ LR(n) and LALR(n) are family of parsing algorithms for CFG --- ###### AST -# TODO: use JavaScript AST dumper +https://esprima.org/demo/parse.html?code=function%20answer()%20%7B%0A%20%20%20%20return%206%20*%207%3B%0A%7D + + { + "type": "FunctionDeclaration", + "id": { "type": "Identifier", "name": "answer" }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "BinaryExpression", + "operator": "*", + "left": { "type": "Literal", "value": 6 }, + "right": { "type": "Literal", "value": 7 } + } + } + ] + }, + } --- ### Middle @@ -233,6 +252,37 @@ that is convenient for: } --- +### WebAssembly + +WebAssembly is actually an IR. + + (module + (func (export "add") (param $n1 i32) (param $n2 i32) (result i32) + get_local $n1 + get_local $n2 + i32.add + ) + ) + +--- +### .NET CIL + +- C#, F#, Basic (some versions), etc target the .NET virtual machine +- Common Intermediate Language + + .class public Foo + { + .method public static int32 Add(int32, int32) cil managed + { + .maxstack 2 + ldarg.0 // load the first argument; + ldarg.1 // load the second argument; + add // add them; + ret // return the result; + } + } + +--- ### Back end > Takes the IR and produces native code for a particular machine @@ -336,5 +386,20 @@ expressions. - antlr --- +### Crash course in JSImpl + +- repository organization +- continous integration +- pull requests + +--- +### Crash course in JSImpl + +- projects +- allocators +- tests + + +--- # ? --- diff --git a/website/data/menu.yaml b/website/data/menu.yaml index 2310032..ad8bb51 100644 --- a/website/data/menu.yaml +++ b/website/data/menu.yaml @@ -1,6 +1,4 @@ - name: Home link: "" -- name: 2018 - link: edition/2018/ - name: About link: about/ |
