diff options
Merge branch 'feature/bison_demo'
8 files changed, 108 insertions, 8 deletions
| -rw-r--r-- | demo/bison/calc/genie.lua | 38 | ||||
| -rw-r--r-- | demo/bison/calc/lex.yy.c | 2 | ||||
| -rw-r--r-- | demo/bison/calc/parser.tab.c | 2 | ||||
| -rw-r--r-- | website/content/post/contents.md | 34 | ||||
| -rw-r--r-- | website/content/post/parser_generators.md | 17 | ||||
| -rw-r--r-- | website/content/post/vm_intro.md | 17 | ||||
| -rw-r--r-- | website/content/slides/03_parsing/_index.md | 2 | ||||
| -rw-r--r-- | website/content/slides/05_vm_intro/_index.md | 4 |
diff --git a/demo/bison/calc/genie.lua b/demo/bison/calc/genie.lua new file mode 100644 index 0000000..62af249 --- /dev/null +++ b/demo/bison/calc/genie.lua @@ -0,0 +1,38 @@ +solution 'BisonDemos' + configurations {'debug', 'release'} + flags { + 'Cpp14', + 'Symbols', + } + configuration '*' + + local root = 'build/' + + + configuration 'debug' + targetdir(root .. 'bin/debug') + objdir(root .. 'obj/debug') + + configuration 'release' + targetdir(root .. 'bin/release') + objdir(root .. 'obj/release') + flags 'OptimizeSpeed' + configuration '*' + + project 'Calc' + kind 'ConsoleApp' + language 'C' + uuid(os.uuid('Calc')) + files { + 'lex.yy.c', + 'parser.tab.c', + } + project 'DebugCalc' + kind 'ConsoleApp' + language 'C' + uuid(os.uuid('DebugCalc')) + defines 'YYDEBUG=1' + files { + 'lex.yy.c', + 'parser.tab.c', + } diff --git a/demo/bison/calc/lex.yy.c b/demo/bison/calc/lex.yy.c index 452fff5..8c0e8b8 100644 --- a/demo/bison/calc/lex.yy.c +++ b/demo/bison/calc/lex.yy.c @@ -1371,7 +1371,7 @@ static void yy_load_buffer_state (void) b->yy_bs_column = 0; } - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + b->yy_is_interactive = 0;//file ? (isatty( fileno(file) ) > 0) : 0; errno = oerrno; } diff --git a/demo/bison/calc/parser.tab.c b/demo/bison/calc/parser.tab.c index 2395da5..b3cfa78 100644 --- a/demo/bison/calc/parser.tab.c +++ b/demo/bison/calc/parser.tab.c @@ -67,7 +67,7 @@ #include <stdio.h> int yylex(); int yyerror(const char* error); -#define YYDEBUG 1 + #line 73 "parser.tab.c" /* yacc.c:339 */ diff --git a/website/content/post/contents.md b/website/content/post/contents.md index 49140f7..5cbbf6a 100644 --- a/website/content/post/contents.md +++ b/website/content/post/contents.md @@ -10,6 +10,8 @@ Table of contents for the course. <!--more--> +## Contents + 0. Course introduction - [slides]({{< ref "/slides/00_intro" >}}), [doc]({{< ref "/intro" >}}) @@ -19,17 +21,17 @@ Table of contents for the course. 0. Lexical analysis - [slides]({{< ref "/slides/02_lexical_analysis" >}}), [doc]({{< ref "/lexer" >}}) -<!-- - 0. Parsing - [slides]({{< ref "/slides/03_parsing" >}}), - [doc](https://github.com/SofiaCPP/IPL/blob/master/website/content/slides/03_parsing/_index.md) + [doc]({{< ref "/parser" >}}) 0. Parser generators - [slides]({{< ref "/slides/04_parser_generators" >}}), - [doc](https://github.com/SofiaCPP/IPL/blob/master/website/content/slides/04_parser_generators/_index.md) + [doc]({{< ref "/parser_generators" >}}) + 0. Intro to virtual machines - [slides]({{< ref "/slides/05_vm_intro" >}}), - [doc](https://github.com/SofiaCPP/IPL/blob/master/website/content/slides/05_vm_intro/_index.md) + [doc]({{< ref "/vm_intro" >}}) +<!-- 0. Values in VMs - [slides]({{< ref "/slides/06_vm_values" >}}), [doc](https://github.com/SofiaCPP/IPL/blob/master/website/content/slides/06_vm_values/_index.md) @@ -49,3 +51,25 @@ Table of contents for the course. [doc](https://github.com/SofiaCPP/IPL/blob/master/website/content/slides/10_vm_gc/_index.md) --> + +## Timeline + + +| Week | Date | Topic | +|------|------------|--------| +| 1 | 06.10.2020 | Intro | +| 2 | 13.10.2020 | Lexers | +| 3 | 20.10.2020 | Parser | +| 4 | 27.10.2020 | Parser | +| 5 | 03.11.2020 | AST | +| 6 | 10.11.2020 | Bytecode | +| 7 | 17.11.2020 | Bytecode | +| 8 | 24.11.2020 | VM | +| 9 | 01.12.2020 | VM | +| 10 | 15.12.2020 | VM | +| 11 | 05.01.2021 | GC | +| 12 | 12.01.2021 | GC | +| 13 | 19.01.2021 | JIT | +| 14 | 26.01.2021 | JIT | +| 15 | 02.02.2021 | AOT | + diff --git a/website/content/post/parser_generators.md b/website/content/post/parser_generators.md new file mode 100644 index 0000000..4320dcc --- /dev/null +++ b/website/content/post/parser_generators.md @@ -0,0 +1,17 @@ +--- +title: "Parser Generators" +date: 2020-10-26 +draft: false +--- + +Overview of parsers generators and how to use them. + +This lecture will be entirely online - see the [Facebook group]({{< ref "/facebook" >}}) + +<!--more--> + +[Slideshow]({{< ref "/slides/04_parser_generators" >}}) + +--- + +{{% readpost file="/slides/04_parser_generators/_index.md" markdown=true %}} diff --git a/website/content/post/vm_intro.md b/website/content/post/vm_intro.md new file mode 100644 index 0000000..23231a4 --- /dev/null +++ b/website/content/post/vm_intro.md @@ -0,0 +1,17 @@ +--- +title: "Parsing" +date: 2020-11-02 +draft: false +--- + +Introduction to virtual machines as a model for computation. + +This lecture will be entirely online - see the [Facebook group]({{< ref "/facebook" >}}) + +<!--more--> + +[Slideshow]({{< ref "/slides/05_vm_intro" >}}) + +--- + +{{% readpost file="/slides/05_vm_intro/_index.md" markdown=true %}} diff --git a/website/content/slides/03_parsing/_index.md b/website/content/slides/03_parsing/_index.md index 8d7f3ed..7fccdcc 100644 --- a/website/content/slides/03_parsing/_index.md +++ b/website/content/slides/03_parsing/_index.md @@ -523,5 +523,7 @@ Extend the xxx2html tool to: cyclomatic complexity ranging from light green to light read. 3. Produce html where control structures can be collapsed. +Do only one of these. + --- # ? diff --git a/website/content/slides/05_vm_intro/_index.md b/website/content/slides/05_vm_intro/_index.md index 5ee5e73..2879fa1 100644 --- a/website/content/slides/05_vm_intro/_index.md +++ b/website/content/slides/05_vm_intro/_index.md @@ -27,6 +27,7 @@ outputs: ["Reveal"] - Implement a computational model - Just like real machines AKA computers - run on top of the real machine +- you can have a hardware implementation of VM --- @@ -282,6 +283,7 @@ Instructions will be between 1 and 25 bytes. - 6 bits for OpCode - we have up to 64 opcodes - 2 bits - n - length of the arguments - 2^n bytes per agrument + - up to 3 arguments per instruction --- ### Instruction set @@ -297,7 +299,7 @@ https://docs.google.com/spreadsheets/d/1Q90x60BF-7T0jqPngScsjlaGBXXHRx4tszwCTSRY - 0 - count of arguments - -1 - first argument - -n - n-th argument -4. caller calls `ret reg`, which removes all locals and arguments and leaves +4. callee calls `ret reg`, which removes all locals and arguments and leaves `reg` on top of the stack 5. caller pops the result from the stack |
