├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── cgen.c ├── cgen.h ├── class ├── archetypes │ └── default.md ├── config.toml ├── content │ ├── _index.md │ └── page │ │ ├── can-i-get-a-job-in-compilers.md │ │ ├── code-generation-for-a-new-programming-language.md │ │ ├── design-a-new-formal-grammar.md │ │ ├── do-compilers-depend-on-the-architecture.md │ │ ├── how-compilers-manage-garbage-collection.md │ │ ├── how-compilers-optimize-code-1.md │ │ ├── how-compilers-optimize-code-2.md │ │ ├── how-computer-runs-code.md │ │ ├── how-to-build-a-new-programming-language.md │ │ ├── how-to-design-a-parser.md │ │ ├── how-to-design-grammars.md │ │ ├── how-to-design-semantic-analysis.md │ │ ├── how-to-generate-runnable-code.md │ │ ├── implementation-recursive-descent-parser.md │ │ ├── implementation-semantic-analysis.md │ │ ├── introduction.md │ │ ├── source-code-optimization-in-compilers.md │ │ ├── what-are-the-differences-in-programming-languages.md │ │ ├── what-is-a-programming-language-grammar.md │ │ ├── what-is-a-programming-language-parser.md │ │ ├── what-is-semantic-analysis-in-compilers.md │ │ ├── where-compilers-use-finite-automata.md │ │ ├── where-compilers-use-regular-expressions.md │ │ ├── why-so-many-programming-languages.md │ │ └── why-some-programming-language-is-faster.md ├── resources │ └── _gen │ │ ├── assets │ │ └── scss │ │ │ └── scss │ │ │ ├── main.scss_76ac6956597c32fec7ddf60d408db3ab.content │ │ │ └── main.scss_76ac6956597c32fec7ddf60d408db3ab.json │ │ └── images │ │ ├── home │ │ └── gallery │ │ │ └── gallery │ │ │ ├── theme-1950s_huaf5482f8cea0c5a703a328640e3b7509_21614_0x190_resize_lanczos_2.png │ │ │ ├── theme-apogee_hu4b45d99db97150df01464c393bfd17d4_24119_0x190_resize_lanczos_2.png │ │ │ ├── theme-coffee-playfair_hu446a8f670cc5622adcc77b97ba95f6c5_22462_0x190_resize_lanczos_2.png │ │ │ ├── theme-dark_hu1e8601ecc47f58eada7743fdcd709d3d_21456_0x190_resize_lanczos_2.png │ │ │ ├── theme-default_huba6228b7bdf30e2f03f12ea91b2cba0d_21751_0x190_resize_lanczos_2.png │ │ │ ├── theme-forest_hu4f093a1c683134431456584193ea41ee_21797_0x190_resize_lanczos_2.png │ │ │ ├── theme-ocean_hu14831ccafc2219f30a7a096fa7617e01_21760_0x190_resize_lanczos_2.png │ │ │ └── theme-strawberry_hu36b0b347fcca08bd39e2df22dcedbdfb_39532_0x190_resize_lanczos_2.png │ │ └── images │ │ ├── icon_hu0b7a4cb9992c9ac0e91bd28ffd38dd00_9727_192x192_fill_lanczos_center_2.png │ │ ├── icon_hu0b7a4cb9992c9ac0e91bd28ffd38dd00_9727_32x32_fill_lanczos_center_2.png │ │ └── icon_hu0b7a4cb9992c9ac0e91bd28ffd38dd00_9727_512x512_fill_lanczos_center_2.png └── static │ ├── css │ └── syntax.css │ └── images │ ├── DFA.png │ ├── ParserClassification.png │ ├── WebApiDsl.png │ ├── exampleParseTree.png │ ├── memory1.png │ ├── memory2.png │ ├── memory3.png │ ├── numDevelopers.png │ ├── parseTree2.png │ ├── parseTree3.png │ ├── stepsBuildCompiler.png │ └── timeToLearn.png ├── code.e ├── docs ├── 404.html ├── categories │ ├── index.html │ └── index.xml ├── css │ ├── bootstrap.min.css │ ├── codeblock.css │ ├── default-skin.png │ ├── fonts.css │ ├── fonts │ │ ├── KaTeX_AMS-Regular.ttf │ │ ├── KaTeX_AMS-Regular.woff │ │ ├── KaTeX_AMS-Regular.woff2 │ │ ├── KaTeX_Caligraphic-Bold.ttf │ │ ├── KaTeX_Caligraphic-Bold.woff │ │ ├── KaTeX_Caligraphic-Bold.woff2 │ │ ├── KaTeX_Caligraphic-Regular.ttf │ │ ├── KaTeX_Caligraphic-Regular.woff │ │ ├── KaTeX_Caligraphic-Regular.woff2 │ │ ├── KaTeX_Fraktur-Bold.ttf │ │ ├── KaTeX_Fraktur-Bold.woff │ │ ├── KaTeX_Fraktur-Bold.woff2 │ │ ├── KaTeX_Fraktur-Regular.ttf │ │ ├── KaTeX_Fraktur-Regular.woff │ │ ├── KaTeX_Fraktur-Regular.woff2 │ │ ├── KaTeX_Main-Bold.ttf │ │ ├── KaTeX_Main-Bold.woff │ │ ├── KaTeX_Main-Bold.woff2 │ │ ├── KaTeX_Main-BoldItalic.ttf │ │ ├── KaTeX_Main-BoldItalic.woff │ │ ├── KaTeX_Main-BoldItalic.woff2 │ │ ├── KaTeX_Main-Italic.ttf │ │ ├── KaTeX_Main-Italic.woff │ │ ├── KaTeX_Main-Italic.woff2 │ │ ├── KaTeX_Main-Regular.ttf │ │ ├── KaTeX_Main-Regular.woff │ │ ├── KaTeX_Main-Regular.woff2 │ │ ├── KaTeX_Math-BoldItalic.ttf │ │ ├── KaTeX_Math-BoldItalic.woff │ │ ├── KaTeX_Math-BoldItalic.woff2 │ │ ├── KaTeX_Math-Italic.ttf │ │ ├── KaTeX_Math-Italic.woff │ │ ├── KaTeX_Math-Italic.woff2 │ │ ├── KaTeX_SansSerif-Bold.ttf │ │ ├── KaTeX_SansSerif-Bold.woff │ │ ├── KaTeX_SansSerif-Bold.woff2 │ │ ├── KaTeX_SansSerif-Italic.ttf │ │ ├── KaTeX_SansSerif-Italic.woff │ │ ├── KaTeX_SansSerif-Italic.woff2 │ │ ├── KaTeX_SansSerif-Regular.ttf │ │ ├── KaTeX_SansSerif-Regular.woff │ │ ├── KaTeX_SansSerif-Regular.woff2 │ │ ├── KaTeX_Script-Regular.ttf │ │ ├── KaTeX_Script-Regular.woff │ │ ├── KaTeX_Script-Regular.woff2 │ │ ├── KaTeX_Size1-Regular.ttf │ │ ├── KaTeX_Size1-Regular.woff │ │ ├── KaTeX_Size1-Regular.woff2 │ │ ├── KaTeX_Size2-Regular.ttf │ │ ├── KaTeX_Size2-Regular.woff │ │ ├── KaTeX_Size2-Regular.woff2 │ │ ├── KaTeX_Size3-Regular.ttf │ │ ├── KaTeX_Size3-Regular.woff │ │ ├── KaTeX_Size3-Regular.woff2 │ │ ├── KaTeX_Size4-Regular.ttf │ │ ├── KaTeX_Size4-Regular.woff │ │ ├── KaTeX_Size4-Regular.woff2 │ │ ├── KaTeX_Typewriter-Regular.ttf │ │ ├── KaTeX_Typewriter-Regular.woff │ │ └── KaTeX_Typewriter-Regular.woff2 │ ├── highlight.min.css │ ├── hugo-easy-gallery.css │ ├── katex.min.css │ ├── main-minimal.css │ ├── main.css │ ├── mermaid.css │ ├── mermaid.dark.css │ ├── photoswipe.default-skin.min.css │ ├── photoswipe.min.css │ ├── staticman.css │ └── syntax.css ├── fontawesome │ ├── css │ │ └── all.css │ └── webfonts │ │ ├── fa-brands-400.eot │ │ ├── fa-brands-400.svg │ │ ├── fa-brands-400.ttf │ │ ├── fa-brands-400.woff │ │ ├── fa-brands-400.woff2 │ │ ├── fa-regular-400.eot │ │ ├── fa-regular-400.svg │ │ ├── fa-regular-400.ttf │ │ ├── fa-regular-400.woff │ │ ├── fa-regular-400.woff2 │ │ ├── fa-solid-900.eot │ │ ├── fa-solid-900.svg │ │ ├── fa-solid-900.ttf │ │ ├── fa-solid-900.woff │ │ └── fa-solid-900.woff2 ├── fonts │ ├── lora │ │ ├── lora-v12-latin-700.eot │ │ ├── lora-v12-latin-700.svg │ │ ├── lora-v12-latin-700.ttf │ │ ├── lora-v12-latin-700.woff │ │ ├── lora-v12-latin-700.woff2 │ │ ├── lora-v12-latin-700italic.eot │ │ ├── lora-v12-latin-700italic.svg │ │ ├── lora-v12-latin-700italic.ttf │ │ ├── lora-v12-latin-700italic.woff │ │ ├── lora-v12-latin-700italic.woff2 │ │ ├── lora-v12-latin-italic.eot │ │ ├── lora-v12-latin-italic.svg │ │ ├── lora-v12-latin-italic.ttf │ │ ├── lora-v12-latin-italic.woff │ │ ├── lora-v12-latin-italic.woff2 │ │ ├── lora-v12-latin-regular.eot │ │ ├── lora-v12-latin-regular.svg │ │ ├── lora-v12-latin-regular.ttf │ │ ├── lora-v12-latin-regular.woff │ │ └── lora-v12-latin-regular.woff2 │ └── open-sans │ │ ├── open-sans-v15-latin-300.eot │ │ ├── open-sans-v15-latin-300.svg │ │ ├── open-sans-v15-latin-300.ttf │ │ ├── open-sans-v15-latin-300.woff │ │ ├── open-sans-v15-latin-300.woff2 │ │ ├── open-sans-v15-latin-300italic.eot │ │ ├── open-sans-v15-latin-300italic.svg │ │ ├── open-sans-v15-latin-300italic.ttf │ │ ├── open-sans-v15-latin-300italic.woff │ │ ├── open-sans-v15-latin-300italic.woff2 │ │ ├── open-sans-v15-latin-600.eot │ │ ├── open-sans-v15-latin-600.svg │ │ ├── open-sans-v15-latin-600.ttf │ │ ├── open-sans-v15-latin-600.woff │ │ ├── open-sans-v15-latin-600.woff2 │ │ ├── open-sans-v15-latin-600italic.eot │ │ ├── open-sans-v15-latin-600italic.svg │ │ ├── open-sans-v15-latin-600italic.ttf │ │ ├── open-sans-v15-latin-600italic.woff │ │ ├── open-sans-v15-latin-600italic.woff2 │ │ ├── open-sans-v15-latin-700.eot │ │ ├── open-sans-v15-latin-700.svg │ │ ├── open-sans-v15-latin-700.ttf │ │ ├── open-sans-v15-latin-700.woff │ │ ├── open-sans-v15-latin-700.woff2 │ │ ├── open-sans-v15-latin-700italic.eot │ │ ├── open-sans-v15-latin-700italic.svg │ │ ├── open-sans-v15-latin-700italic.ttf │ │ ├── open-sans-v15-latin-700italic.woff │ │ ├── open-sans-v15-latin-700italic.woff2 │ │ ├── open-sans-v15-latin-800.eot │ │ ├── open-sans-v15-latin-800.svg │ │ ├── open-sans-v15-latin-800.ttf │ │ ├── open-sans-v15-latin-800.woff │ │ ├── open-sans-v15-latin-800.woff2 │ │ ├── open-sans-v15-latin-800italic.eot │ │ ├── open-sans-v15-latin-800italic.svg │ │ ├── open-sans-v15-latin-800italic.ttf │ │ ├── open-sans-v15-latin-800italic.woff │ │ ├── open-sans-v15-latin-800italic.woff2 │ │ ├── open-sans-v15-latin-italic.eot │ │ ├── open-sans-v15-latin-italic.svg │ │ ├── open-sans-v15-latin-italic.ttf │ │ ├── open-sans-v15-latin-italic.woff │ │ ├── open-sans-v15-latin-italic.woff2 │ │ ├── open-sans-v15-latin-regular.eot │ │ ├── open-sans-v15-latin-regular.svg │ │ ├── open-sans-v15-latin-regular.ttf │ │ ├── open-sans-v15-latin-regular.woff │ │ └── open-sans-v15-latin-regular.woff2 ├── images │ ├── DFA.png │ ├── ParserClassification.png │ ├── WebApiDsl.png │ ├── exampleParseTree.png │ ├── memory1.png │ ├── memory2.png │ ├── memory3.png │ ├── numDevelopers.png │ ├── parseTree2.png │ ├── parseTree3.png │ ├── stepsBuildCompiler.png │ └── timeToLearn.png ├── img │ ├── avatar-favicon.png │ ├── avatar-icon.png │ ├── favicon.ico │ ├── favicon.ico.zip │ ├── hexagon-thumb.jpg │ ├── hexagon.jpg │ ├── path.jpg │ ├── sphere-thumb.jpg │ ├── sphere.jpg │ ├── triangle-thumb.jpg │ └── triangle.jpg ├── index.html ├── index.xml ├── js │ ├── auto-render.min.js │ ├── bootstrap.min.js │ ├── highlight.min.js │ ├── jquery.min.js │ ├── katex.min.js │ ├── load-photoswipe.js │ ├── main.js │ ├── mermaid.js │ ├── photoswipe-ui-default.min.js │ ├── photoswipe.min.js │ ├── recaptcha.js │ └── staticman.js ├── page │ ├── 1 │ │ └── index.html │ ├── can-i-get-a-job-in-compilers │ │ └── index.html │ ├── code-generation-for-a-new-programming-language │ │ └── index.html │ ├── design-a-new-formal-grammar │ │ └── index.html │ ├── do-compilers-depend-on-the-architecture │ │ └── index.html │ ├── how-compilers-manage-garbage-collection │ │ └── index.html │ ├── how-compilers-optimize-code-1 │ │ └── index.html │ ├── how-compilers-optimize-code-2 │ │ └── index.html │ ├── how-computer-runs-code │ │ └── index.html │ ├── how-to-build-a-new-programming-language │ │ └── index.html │ ├── how-to-design-a-parser │ │ └── index.html │ ├── how-to-design-grammars │ │ └── index.html │ ├── how-to-design-semantic-analysis │ │ └── index.html │ ├── how-to-generate-runnable-code │ │ └── index.html │ ├── implementation-recursive-descent-parser │ │ └── index.html │ ├── implementation-semantic-analysis │ │ └── index.html │ ├── index.html │ ├── index.xml │ ├── introduction │ │ └── index.html │ ├── page │ │ ├── 1 │ │ │ └── index.html │ │ ├── 2 │ │ │ └── index.html │ │ └── 3 │ │ │ └── index.html │ ├── source-code-optimization-in-compilers │ │ └── index.html │ ├── what-are-the-differences-in-programming-languages │ │ └── index.html │ ├── what-is-a-programming-language-grammar │ │ └── index.html │ ├── what-is-a-programming-language-parser │ │ └── index.html │ ├── what-is-semantic-analysis-in-compilers │ │ └── index.html │ ├── where-compilers-use-finite-automata │ │ └── index.html │ ├── where-compilers-use-regular-expressions │ │ └── index.html │ ├── why-so-many-programming-languages │ │ └── index.html │ └── why-some-programming-language-is-faster │ │ └── index.html ├── sitemap.xml └── tags │ ├── index.html │ └── index.xml ├── grammar ├── lexer.c ├── lexer.h ├── main.c ├── parser.c ├── parser.h ├── semantic.c ├── semantic.h └── test_parser ├── test_1.c ├── test_10.c ├── test_11.c ├── test_2.c ├── test_3.c ├── test_4.c ├── test_5.c ├── test_6.c ├── test_7.c ├── test_8.c ├── test_9.c ├── test_code_1 ├── test_code_10 ├── test_code_11 ├── test_code_2 ├── test_code_3 ├── test_code_4 ├── test_code_5 ├── test_code_6 ├── test_code_7 ├── test_code_8 └── test_code_9 /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Object files 5 | *.o 6 | *.ko 7 | *.obj 8 | *.elf 9 | 10 | # Linker output 11 | *.ilk 12 | *.map 13 | *.exp 14 | 15 | # Precompiled Headers 16 | *.gch 17 | *.pch 18 | 19 | # Libraries 20 | *.lib 21 | *.a 22 | *.la 23 | *.lo 24 | 25 | # Shared objects (inc. Windows DLLs) 26 | *.dll 27 | *.so 28 | *.so.* 29 | *.dylib 30 | 31 | # Executables 32 | *.exe 33 | *.out 34 | *.app 35 | *.i*86 36 | *.x86_64 37 | *.hex 38 | 39 | # Debug files 40 | *.dSYM/ 41 | *.su 42 | *.idb 43 | *.pdb 44 | 45 | # Kernel Module Compile Results 46 | *.mod* 47 | *.cmd 48 | .tmp_versions/ 49 | modules.order 50 | Module.symvers 51 | Mkfile.old 52 | dkms.conf 53 | 54 | # This Project files 55 | out.py 56 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "class/themes/beautifulhugo"] 2 | path = class/themes/beautifulhugo 3 | url = https://github.com/pgrandinetti/beautifulhugo.git 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Compilers 2 | _My open course on Compilers, Grammars and Programming Languages_ 3 | 4 | This repository contains the code I wrote for my _self-inflicted_ class about Compilers . 5 | 6 | **Use it at your risks**. 7 | 8 | ## About the project 9 | 10 | As side project for a MOOC on Compilers I built a new (basic) programming language. Turing-complete, but without supports for many things. 11 | 12 | This repo contains the Grammar's specifications, as well as the compiler for this new language, written in C and organized in 4 modules: 13 | 14 | - Lexical Analysis 15 | - Parsing 16 | - Semantic Analysis 17 | - Code Generation 18 | 19 | ## Compile! 20 | 21 | 1. Compile my Compiler! You'll need a C compiler, e.g. `gcc main.c cgen.c parser.c lexer.c` 22 | 2. Write your program in _my language_ and place it in a text file. An example is offered in the repo with the file `code.e`. 23 | 3. Now compile your program with `./a.out ./code.e`. 24 | 25 | The result is a Python executable script, by default `./out.py`. You can optionally run `./a.out ./code.e /home/user/result.py`, to specify the path for the output file. 26 | 27 | ## Question? 28 | 29 | - Why generated code is in Python? 30 | - What is _my language_? 31 | - How does the Compiler work? 32 | 33 | Answers: 34 | -------------------------------------------------------------------------------- /cgen.h: -------------------------------------------------------------------------------- 1 | #include "parser.h" 2 | 3 | #define INDENT_LEV 4 4 | 5 | char* code_gen (struct ParseTree *root); 6 | -------------------------------------------------------------------------------- /class/archetypes/default.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "{{ replace .Name "-" " " | title }}" 3 | date: {{ .Date }} 4 | draft: true 5 | --- 6 | 7 | -------------------------------------------------------------------------------- /class/config.toml: -------------------------------------------------------------------------------- 1 | baseURL = "https://pgrandinetti.github.io/compilers" 2 | languageCode = "en-us" 3 | title = "Compilers" 4 | 5 | DefaultContentLanguage = "en" 6 | #DefaultContentLanguage = "ja" 7 | theme = "beautifulhugo" 8 | metaDataFormat = "yaml" 9 | pygmentsStyle = "trac" 10 | pygmentsUseClasses = true 11 | pygmentsCodeFences = true 12 | pygmentsCodefencesGuessSyntax = true 13 | #pygmentsUseClassic = true 14 | #pygmentOptions = "linenos=inline" 15 | #disqusShortname = "XXX" 16 | #googleAnalytics = "XXX" 17 | 18 | relativeURLs=true 19 | 20 | math = true 21 | 22 | [Params] 23 | # homeTitle = "Beautiful Hugo Theme" # Set a different text for the header on the home page 24 | subtitle = "Nuts and bolts of Programming Languages" 25 | mainSections = ["post","posts"] 26 | #logo = "img/avatar-icon.png" # Expecting square dimensions 27 | #favicon = "img/favicon.ico" 28 | dateFormat = "January 2, 2006" 29 | commit = false 30 | rss = true 31 | #comments = true 32 | readingTime = true 33 | #wordCount = true 34 | useHLJS = false 35 | socialShare = true 36 | delayDisqus = true 37 | showRelatedPosts = true 38 | hideAuthor = true 39 | # gcse = "012345678901234567890:abcdefghijk" # Get your code from google.com/cse. Make sure to go to "Look and Feel" and change Layout to "Full Width" and Theme to "Classic" 40 | 41 | #[[Params.bigimg]] 42 | # src = "img/triangle.jpg" 43 | # desc = "Triangle" 44 | #[[Params.bigimg]] 45 | # src = "img/sphere.jpg" 46 | # desc = "Sphere" 47 | # # position: see values of CSS background-position. 48 | # position = "center top" 49 | #[[Params.bigimg]] 50 | # src = "img/hexagon.jpg" 51 | # desc = "Hexagon" 52 | 53 | [Author] 54 | name = "Pietro" 55 | # website = "yourwebsite.com" 56 | # email = "youremail@domain.com" 57 | github = "pgrandinetti" 58 | # gitlab = "username" 59 | # bitbucket = "username" 60 | # twitter = "username" 61 | # reddit = "username" 62 | linkedin = "grandinettipietro" 63 | # xing = "username" 64 | # stackoverflow = "users/XXXXXXX/username" 65 | # snapchat = "username" 66 | # instagram = "username" 67 | # youtube = "user/username" # or channel/channelname 68 | # soundcloud = "username" 69 | # spotify = "username" 70 | # bandcamp = "username" 71 | # itchio = "username" 72 | # vk = "username" 73 | # paypal = "username" 74 | # telegram = "username" 75 | # 500px = "username" 76 | # codepen = "username" 77 | # mastodon = "url" 78 | # kaggle = "username" 79 | # weibo = "username" 80 | # slack = "username" 81 | 82 | [[menu.main]] 83 | name = "Contents" 84 | url = "/" 85 | weight = 1 86 | 87 | [[menu.main]] 88 | name = "About" 89 | url = "page/introduction" 90 | weight = 2 91 | 92 | [[menu.main]] 93 | name="Code" 94 | url = "https://github.com/pgrandinetti/compilers" 95 | weight = 3 96 | -------------------------------------------------------------------------------- /class/content/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Table of Contents" 3 | date: 2019-12-29 4 | draft: false 5 | --- 6 | 7 | # Contents 8 | 9 | 10 | [Introduction]({{< ref "/page/introduction" >}}) 11 | 12 | 13 | ### Part A - Answer the Questions 14 | 15 | 1. [Can I get a job after I study Compilers?]({{< ref "/page/can-i-get-a-job-in-compilers" >}}) 16 | 2. [Why are there so many programming languages?]({{< ref "/page/why-so-many-programming-languages" >}}) 17 | 3. [What are the differences between programming languages?]({{< ref "/page/what-are-the-differences-in-programming-languages" >}}) 18 | 4. [What is a Grammar in Programming Languages?]({{< ref "/page/what-is-a-programming-language-grammar" >}}) 19 | 5. [How to build a new programming language]({{< ref "/page/how-to-build-a-new-programming-language" >}}) 20 | 6. [What is a programming language parser?]({{< ref "/page/what-is-a-programming-language-parser" >}}) 21 | 7. [What is Semantic Analysis in a Compiler?]({{< ref "/page/what-is-semantic-analysis-in-compilers" >}}) 22 | 8. [How does the computer execute code?]({{< ref "/page/how-computer-runs-code" >}}) 23 | 9. [How to generate runnable code in a Compiler?]({{< ref "/page/how-to-generate-runnable-code" >}}) 24 | 25 | ### Part B - Build the Knowledge 26 | 27 | 1. [How to design Formal Grammars]({{< ref "/page/how-to-design-grammars" >}}) 28 | 2. [How to design a Programming Language Parser]({{< ref "/page/how-to-design-a-parser" >}}) 29 | 3. [How to design Semantic Analysis]({{< ref "/page/how-to-design-semantic-analysis" >}}) 30 | 4. [Where do Compilers use Regular Expressions?]({{< ref "/page/where-compilers-use-regular-expressions" >}}) 31 | 5. [Where do Compilers use Finite Automata?]({{< ref "/page/where-compilers-use-finite-automata" >}}) 32 | 6. [Source Code Optimization in Compilers]({{< ref "/page/source-code-optimization-in-compilers" >}}) 33 | 7. [How Compilers manage the Garbage Collector]({{< ref "/page/how-compilers-manage-garbage-collection" >}}) 34 | 35 | ### Part C - Challenge What You Know 36 | 37 | 1. [Why are some programming languages faster than others?]({{< ref "/page/why-some-programming-language-is-faster" >}}) 38 | 2. [Do Compilers depend on the computers architecture?]({{< ref "/page/do-compilers-depend-on-the-architecture" >}}) 39 | 3. [How do Compilers Optimize the Source Code? (Part I)]({{< ref "/page/how-compilers-optimize-code-1" >}}) 40 | 4. [How do Compilers Optimize the Source Code? (Part II)]({{< ref "/page/how-compilers-optimize-code-2" >}}) 41 | 42 | ### Part D - Do it Yourself 43 | 44 | 1. [Design of a new Context-Free Grammar]({{< ref "/page/design-a-new-formal-grammar" >}}) 45 | 2. [Implementation of a Recursive Descent Parser]({{< ref "/page/implementation-recursive-descent-parser" >}}) 46 | 3. [Implementation of Semantic Analysis]({{< ref "/page/implementation-semantic-analysis" >}}) 47 | 4. [Code Generation for a new Programming Language]({{< ref "/page/code-generation-for-a-new-programming-language" >}}) 48 | 49 | -------------------------------------------------------------------------------- /class/content/page/can-i-get-a-job-in-compilers.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Can I Get a Job After I Study Compilers?" 3 | date: 2019-09-27 4 | draft: false 5 | --- 6 | 7 | 8 | The answer is a resounding **absolutely yes**, even though it will depend on the type of job you're looking for, of course. 9 | 10 | Funnily enough, if you are a scientist and specialize in some niche topic, you might find that there are a lot of jobs available to those who are fluent in Compilers, Parsers and general Programming Language theory. 11 | 12 | ## But… Why? And How? 13 | 14 | The reason is that basic Parsing and Grammar theory is ubiquitous, and it's hidden in places you would never imagine. 15 | 16 | The "big name" in this scenario is **Domain Specific Languages**. 17 | 18 | From Wikipedia: 19 | 20 | _A *domain-specific language (DSL)* is a computer language specialized to a particular application domain. This is in contrast to a general-purpose language (GPL), which is broadly applicable across domains. There are a wide variety of DSLs, ranging from widely used languages for common domains [...] down to languages used by only one or a few pieces of software [...]._ 21 | 22 | In other words, a lot of applications out there have some component that is based on a DSL. The classic example is a web application that exposes an API where users can perform queries to the server's database. 23 | 24 | ## A typical startup job 25 | 26 | Let's make this same example more concrete. Say, you have collected a lot of data about temperature and weather in a given city, for the past 5 years. There was no such a database available on the internet, and it took you a lot of work to build it. 27 | 28 | Now, you want to sell access to this database, maybe as a small monthly fee. In what form should you grant access to the data, to your paying customers? 29 | 30 | You could tell them - Hey, write your own SQL query, send it over and my web app will send you data in CSV format. This would be a **huge mistake**: 31 | 32 | * You can't really assume your customers know the SQL language. 33 | * You can't trust them! They could send over *malicious query*, that would corrupt your data. 34 | 35 | A better alternative, sound and implemented by many web services, is to ask the user to send a JSON, where the fields in the JSON correspond to fields in your DB. This is fine, although it requires a POST request, and additional data sent over the network. 36 | 37 | A third alternative, that **I personally implemented for a paid project**, is to design the web server such that it supports URLs like the following 38 | 39 | `domain-name.com/weather?q=city is NYC and (temp gt 45 or month is Oct)` 40 | 41 | Bear in mind that spaces in the URL must be encoded correctly (usually "%20"). I didn't do it in the example for the sake of clarity. 42 | 43 | So, what is happening within that URL? Your customer is sending a standard GET request, where the `q` (aka "query") part is written in... something that looks like English! They are looking for entries in your DB where the city is NYC and the temperature is higher than 45 (gt, normally stands for greater than) or the month is October. 44 | 45 | Does it remind you of anything? Yes, Google's search engine API works very similarly to this. 46 | 47 | ![Draft Design of a DSL-base Web API](/images/WebApiDsl.png) 48 | 49 | But how does your web app work underneath? How does it know what the query part means? There's only one possibility: *you created a Domain Specific Language* for your application. 50 | 51 | - You defined a small Grammar, with keywords such as "is", "gt", "and", "or". 52 | - You implemented a lightweight Parser, that checks that the queries sent by your customers are correctly typed (and otherwise inform them about their mistakes). 53 | - You built a small translation module from your DSL to raw SQL, **inside your web server**, so that it's safe. 54 | 55 | More realistically, you hired someone with experience in Compilers, Languages and DSL to do this for you. 56 | 57 | ## What about enterprise jobs? 58 | 59 | Sure, if you are really ambitious you can drop an email to someone at Oracle, and ask if they have open positions in the team that works on Java. Be sure to calibrate your wordings: you don't want a position in some team that works _with_ Java! 60 | 61 | I like to be more realistic though. The truth is that, today, **most Programming Languages are open-source**. Therefore, you can't get a job directly to work on that. 62 | 63 | It's more about what you are ready to give, and *how you want to contribute*. For example, you could contribute to the development of the Python Language, if that's something you like: 64 | 65 | 1. Check out Python's code from GitHub. 66 | 2. Study it (good luck!). You'll need the source code as much as the official documentation. 67 | 3. Choose one module, or even just one thing in the language (e.g., list), and go deeper in your studies about that part. 68 | 4. Identify optimization spots, read the Developer's guide and submit a Merge Request. 69 | 70 | If you think this would not be a "job", and therefore just a big waste of time, then think again. If you build yourself a reputation as an outstanding developer, so good that you made a serious contribution (not just some documentation file) to a BIG project such as Python, *you won't have any trouble in finding a very well paid job*. 71 | 72 | ## Do you care about Computer Science? 73 | 74 | I would like to drive the focus on the importance of studying Programming Languages and Compilers Theory, **regardless of your job status**. 75 | 76 | _As a well-known fact, there are two types of code developers out there._ 77 | 78 | The one who likes to get some quick and dirty result, and then see what happens. Or the one who wants to acquire the most solid knowledge she can, about a certain topic, and is confident that things will roll in her favor. I call the first ones programmers, the second ones scientists. 79 | 80 | If you are scared about the many possibilities and choices that are offered in everyone's professional life, then you should not study Compilers. 81 | 82 | Just learn how to code in a couple of Programming Languages of your choice. **Learn how to use** Programming Languages. 83 | 84 | You'll get tested about your skills, in the very standard way that we call "job application" today. And if you are convincing enough, *you might get a very good position as a programmer*. 85 | 86 | But if you get excited when there are many roads, and some of them are unclear, then you belong to the second group. That's where I belong to as well. 87 | 88 | Today's competition for a job position is brutal. This has the very sad side-effect that most people content themselves with the minimal necessary knowledge to get stuff done. I wish them the best, but I doubt they can go very far this way. 89 | 90 | **In a world of fierce competition, knowledge is your best and only weapon.** 91 | 92 | Even if you don't see in your professional horizons how or when a complex topic like Compilers could be useful, I recommend you to dedicate time to your *professional growth*. This is a subject that touches in depth many areas of Computer Science, from advanced algorithms and data structures, automata, computer's architecture and even AI (in the classical meaning of AI, that is greedy and heuristic search). If you master it, you'll be a better Computer Scientist. If you master it, it will help you. *It did help me*. 93 | 94 | Learn how to build programming languages, not just how to use a couple of them. It will get you ahead of the competition. 95 | 96 | From a Quora discussion: 97 | 98 | _If you can truthfully claim that you have written a compiler with your own hands, it is likely that there will be no questions asked after that in any interview._ 99 | 100 | ## Conclusions 101 | 102 | I know my view on this subject may sound odd to some, but it's my firm belief that **knowledge is never a waste**. 103 | 104 | When I studied Compilers and Programming Languages in depth I already was working as a software engineer. Nonetheless, I decided to spend many months studying that, and also self-assigning myself a tough project (more about it in the next articles). 105 | 106 | I gained so much from those months. Invaluable knowledge and insights about algorithms, data structures and the inner "secret" of Programming Languages. 107 | 108 | I did get more job opportunities thanks to this, and you can too. 109 | 110 | ## References 111 | 112 | Quora discussion on the benefits of studying Compilers: . 113 | 114 | Stack Overflow thread on the benefits of studying Compilers: . 115 | 116 | Source code for the Python Programming Language: . 117 | 118 | Startup jobs listing filtered with the keyword "Compiler", on [angel.co](https://angel.co/jobs#find/f!%7B%22skills%22%3A%5B%22Compiler%20Design%22%2C%22Compilers%22%5D%7D) (might need log-in. No affiliations!). 119 | -------------------------------------------------------------------------------- /class/content/page/do-compilers-depend-on-the-architecture.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Do Compilers Depend on the Computer Architecture?" 3 | date: 2019-10-13 4 | draft: false 5 | --- 6 | 7 | In all previous articles in this course, I tried to emphasize equally all steps in the compilation: 8 | 9 | 1. Lexical Analysis 10 | 2. Parsing 11 | 3. Semantic Analysis 12 | 4. Optimization 13 | 5. Code Generation 14 | 15 | For some reason, though, I noticed that the first three steps receive a lot of attention, usually much more than the last two. 16 | 17 | Moreover, the first three steps form what’s usually called front-end compilation, as opposed to the back-end compilation that if formed by the last two. 18 | 19 | The goal of the front-end is to make sure the source code is well-written, as well as to produce some data structure that will be useful for the back-end. 20 | 21 | The key point I want to make is that front-end is indeed an abstract process. It’s about algorithms, formal grammars, regular expressions and finite automata. In other words, **front-end is independent from the computer architecture**. 22 | 23 | However, front-end is just one part of the Compiler. The back-end strongly depends on the computer architecture. 24 | 25 | Therefore, **it’s correct to say that Compilers do depend on computers architecture**. 26 | 27 | Let’s get now deeper into the why. 28 | 29 | ## Procedures and Activations 30 | 31 | Let’s start with a fair approximation: **a Program is made of Procedures**. 32 | 33 | We are used to thinking about Procedures as pieces of reusable code (that is, functions). That’s true at all levels of coding, including machine-level such as Assembly code. 34 | 35 | In Assembly code, for example, we can think of procedure like pieces of code delimited by the labels and the jump instructions. And if there isn’t any such block, then we can think of the whole program as a procedure. 36 | 37 | In either case, the activation of a procedure needs to be handled with care by the executing environment. 38 | 39 | Let’s think about the trickiest points with procedures: 40 | 41 | - Input data and variables names must be confined to that procedure’s execution (this happens in all languages of practical relevance). 42 | - There needs to be a link to the caller, that’s the piece of code that invoked the procedure. 43 | - Storing the return value. 44 | - The return address, that’s the line of code, in the whole program, that must be executed after the procedure has finished. 45 | 46 | To complicate things further, consider that even though the various blocks are logically separated, the entire storage is really just one gigantic array in memory. And the fact that elements in the array are contiguous plays an important role. 47 | 48 | All considered, we should imagine the activation record of a procedure like a block of memory that stores the information needed to correctly execute that procedure within the program. 49 | 50 | ## Enters Compiler 51 | 52 | Why and how does a Compiler gets to play with the activation record? 53 | 54 | The answer is relatively easy: **the activation record is designed at compile time**. 55 | 56 | It couldn’t be in a different way, because it’s absolutely necessary to know each word of memory within the record, in order to correctly execute the program at a later stage. 57 | 58 | In other words, the compiler must be able to determine the layout of the activation records, and generate code that can access any sub-block in any of such records. This means, **Activation Record layout and Code Generation must be designed together**. 59 | 60 | Think about in this way. If the first word of memory in the activation record is reserved for the return value of the procedure, then the Compiler must know it, because it’s a key information for executing the program. 61 | 62 | And what’s the only way to know that with absolute certainty? Well, the Compiler must be the designer of the activation record. 63 | 64 | ## Summary 65 | 66 | To summarize the content of this article, remember: **a well-designed Compiler knows, depends on and takes advantage of the underlying computer’s architecture**. 67 | 68 | This is evident in particular in the stage called Runtime Organization. 69 | 70 | There, the Compiler literally design how to organize the memory (and sometimes the storage too) of the machine, in order to build the best execution environment for the program. 71 | 72 | Activation records for procedures, also called activation frames, are the key elements that allow the correct management of procedures within the program. They are meant to store information such as the return address and value, arguments to the procedures itself and a link to the caller. Furthermore, **the Compiler is in charge to design the layout of the activation frames**. 73 | 74 | Finally, it’s worth mentioning that these are fairly advanced subjects. Strong Compilers out there definitely take them into account and do an excellent job with it. But if you want to experiment and build a smaller Compiler, then you can take these concepts a bit less strictly. 75 | 76 | ## References 77 | 78 | My article [How does the Computer Run Code?]({{< ref "/page/how-computer-runs-code.md" >}}). 79 | -------------------------------------------------------------------------------- /class/content/page/introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Introduction 3 | description: Overview of the free course on Compilers, Programming Languages and Formal Grammars 4 | date: "2019-10-06" 5 | --- 6 | 7 | Welcome to my _self-inflicted_ **course on Compilers, Formal Grammars and Programming Languages!** 8 | 9 | This is a subject I had been wanting to explore for a long time. It wasn't taught as part of my BSc in Software Engineering, and my other degrees were about Automation and Optimization, so it fell off the table. 10 | 11 | Yet, I felt I could not stand this large missing piece of knowledge for very long. Thus, I gathered the best MOOC and the 2 best books on the arguments and started studying. 12 | 13 | True to [my own ideas on MOOCs](https://medium.com/@pgrandinetti/make-the-most-out-of-your-mooc-97f806e6a70) I decided to self-assign to myself a complex project: **to build a new programming language**, without using any of the automated tools available out there, in order to practice and implement with my own hands all concepts. 14 | 15 | The overall learning experience has been fantastic, and its results are: 16 | 17 | - A [series of articles/classes]({{< ref "/" >}}) on the subject (start from here!). 18 | - A [GitHub repository](https://github.com/pgrandinetti/compilers) for a new programming language. 19 | 20 | 21 | ### Get in touch 22 | 23 | MOOCs are only half-useful without other students' feedback. I warmly encourage you to get in touch for questions, comments and suggestions. You can: 24 | 25 | - Reach out via [my LinkedIn page](https://linkedin.com/in/grandinettipietro) 26 | - Open a [GitHub issue](https://github.com/pgrandinetti/compilers/issues) 27 | -------------------------------------------------------------------------------- /class/content/page/where-compilers-use-finite-automata.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Where Do Compilers Use Finite Automata?" 3 | date: 2019-10-11 4 | draft: false 5 | --- 6 | 7 | Finite Automata... What a fancy name! 8 | 9 | Formally, **they are computational machines with a finite number of states**. 10 | 11 | For instance, a digital watch counting only hours and minutes is a finite state machine, because it can only in one out of 1440 states (24 "hour state" times 60 "minute state" for each hour). 12 | 13 | A washing machine can be seen as a finite state machine too. It starts in the "Ready" state, then goes onto the "Washing" state, followed by the "Drying" state. There may be more intermediate states, but the total number is certainly finite! 14 | 15 | The more important question to me, now, is what's the role of Finite Automata in the process of building a new programming Language? **Where are Finite Automata used within Compilers?** 16 | 17 | ## Background 18 | 19 | In the previous article in this course we learned a great deal about Regular Expressions. I warmly recommend you to read that article again (see the references at the end). The key concept, however, are the following: 20 | 21 | - The second step of the compilation is called Lexical Analysis. 22 | - Lexical Analysis takes care of transforming the original source code (that's a sequence of characters), into a sequence of substrings (called lexemes), each with its own class (such as keyword, operator, etc.). 23 | - Regular Expressions are used to match each lexeme with one class. 24 | 25 | I also showed examples regarding the last point. In summary, matching a lexeme to a class consists in the classic pattern-matching operation. For instance, you'd want to match the lexeme 26 | 27 | ``` 28 | "if" 29 | ``` 30 | 31 | With the pattern `keyword`, given by 32 | 33 | ``` 34 | "if | else | while | for | return" 35 | ``` 36 | 37 | In Python, you would do: 38 | 39 | ```python 40 | import re 41 | pattern = 'r^(if|else|for|while|return)$' 42 | st = 'if' 43 | print(bool(re.match(pattern, st))) # >> True 44 | ``` 45 | 46 | The point where Finite Automata enter the Compiler's game is **the execution of Regular Expression**. Or you can say, in the implementation of regular expressions. Let's see it more in detail. 47 | 48 | ## How to implement a Regular Expression 49 | 50 | First of all, what does it mean to "implement" a regular expression? It means finding a procedure to decide whether a given sentence is valid for a given regular expression. 51 | 52 | Remember that **the overall objective is to accept or reject a sentence**. A sentence is just a string (a sequence of characters). Given a regular language defined by a set of regular expressions, for each new sentence we must decide whether it is valid (accept) or not valid (reject) for this language. 53 | 54 | **Finite Automata is the most commonly used tool to implement regular languages**. 55 | 56 | It's nearly impossible to give a detailed discussion about Finite Automata in this article (and it'd probably be confusing too), so I simply want to discuss the core of it. 57 | 58 | A Deterministic Finite Automata (DFA) is defined by the following elements: 59 | 60 | - An input Alphabet (set of characters). 61 | - A finite set of states, $S$. 62 | - A start state, $n$ that belongs to $S$. 63 | - A set of terminal states, $F$ subset of $S$. 64 | - A set of transitions $T$, that are rules about going from one state to another one. 65 | 66 | A transition is a rule of the form "when in state s1, if you read character c1 move to state s2. If you read c2 then move to state s3." Additionally, and very importantly, a DFA can have **only one transition for each state for the same character**. This is what it makes it deterministic. 67 | 68 | It's very common to use graphs like the one below to represent DFA. 69 | 70 | ![Example of Deterministic Finite Automata](/images/DFA.png) 71 | 72 | The key element of this DFA are the following ones: 73 | 74 | - The Alphabet is ${"0", "1"}$ (you must know it in advance). 75 | - The start state is $n$, and it is indicated by the arrow entering it from nowhere. 76 | - The terminal states set is ${f}$. These are indicated by the double circled notations. 77 | - When in state $n$, if the char "0" is read then the machine goes into state $f$. 78 | - When in state $n$, if the character "1" is read then the machine stays in the same state. 79 | 80 | How does this DFA work? Let's assume we have the sentence "110" and must decide to accept or reject it. Let's see what happens step by step. 81 | 82 | - The DFA starts in state $n$ and reads character "1" (the first in the sentence). 83 | - It stays in the same state, as prescribed by the transition. 84 | - It reads character "1" (the second in the sentence). 85 | - It stays in the same state. 86 | - It reads character "0". 87 | - It switches to state $f$. 88 | 89 | At this point the input sentence has been read and the machine is in a terminal state. So the sentence is accepted. 90 | 91 | To be more formal: 92 | 93 | - If the input sentence is entirely read and the machine ends in a terminal state, then the sentence is accepted. 94 | - If the sentence is entirely read and the machine ends in a non terminal state, then the sentence is rejected. 95 | - If the sentence is not entirely read because the machine is stuck at any point, then the sentence is rejected. 96 | 97 | Let's consider the sentence "120". 98 | 99 | 1. The DFA starts in state $n$ and reads character "1" (the first in the sentence). 100 | 2. It stays in the same state, as prescribed by the transition. 101 | 3. It reads character "2" (the second in the sentence). 102 | 4. There is no transition for this character from the current state, so the machine is stuck and the input is rejected. 103 | 104 | Let's consider "101". 105 | 106 | 1. The DFA starts in state $n$ and reads character "1" (the first in the sentence). 107 | 2. It stays in the same state. 108 | 3. It reads character "0". 109 | 4. It switches to state $f$. 110 | 5. It reads character "1" 111 | 6. There is no transition for this character from the current state, so the machine is stuck and the input is rejected. 112 | 113 | So, the question is: **what does this DFA do in plain English?** 114 | 115 | This DFA accept sentences of any length that are made by "1"s characters and have a "0" as last character only. So for example "10", "110", "1110" are all valid, but "101" and "1010" are not. 116 | 117 | The key thing to know is that **Deterministic Finite Automata and Regular Languages are equivalent formalisms**. This means that: 118 | 119 | - Given a DFA there will always be at least one Regular Language that accept the same set of sentences. 120 | - Given a Regular Language there always is at least one DFA that accept the same set of sentences. 121 | 122 | On the other hand, regular expressions have weaker expressivity than what you need to describe a full programming language. To handle that you need Context-Free Grammars. 123 | 124 | Also, by construction of DFA is relatively easy to build a procedure that checks for acceptance / rejection of a sentence. It is basically as simple as one iterative loop over the characters of the sentence: 125 | 126 | ```C 127 | int i = 0; 128 | int curr_state = n; 129 | char [] input = ... // some sentence 130 | while (input[i]){ 131 | curr_state = lookup_transitions_table(curr_state, input[i++]); 132 | } 133 | if (is_terminal(curr_state)) 134 | ACCEPT; 135 | REJECT; 136 | ``` 137 | 138 | This pseudo-code also lets you guess that the fastest way to implement a DFA in the memory of a real computer is not with a fancy-looking graph, but with a lookup table that maps transitions to states... but this is a story for another article. 139 | 140 | ## Wait! What about Grammars? 141 | 142 | Right. I think I threw in a cryptic sentence a bit above: "Regular expressions have weaker expressivity than what you need to describe a full programming language. To handle that you need Context-Free Grammars." 143 | 144 | What the heck does that mean?! 145 | 146 | Like for Finite Automata, I am not going to go into a detailed analysis of Context-Free Grammars right now, so I will just leave you with a challenge. 147 | 148 | Take a look at the following, simple, arithmetic expression. 149 | 150 | ``` 151 | (5 + (2 * (1+3))) 152 | ``` 153 | 154 | This is an example of a well-formed expression, meaning that it's correctly written and, in particular, parentheses are correctly closed. 155 | 156 | To express well-formed arithmetic expressions that use only sum and products with a Context-Free Grammar does not require much effort: 157 | 158 | ``` 159 | expression : sum 160 | sum : product ('+' product)* 161 | product : value ('*' value)* 162 | value : digit | ('(' expression ')') 163 | digit : '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' 164 | ``` 165 | 166 | So, my challenge for you is the following. Given just two of the basic arithmetic operations, sum `+` and product `*`, write a regular expression that catches all well-formed arithmetic expressions. Let me know when you are done with it. 167 | 168 | ## References 169 | 170 | My article [Where do Compilers Use Regular Expressions?]({{< ref "/page/where-compilers-use-regular-expressions" >}}). 171 | -------------------------------------------------------------------------------- /class/content/page/why-so-many-programming-languages.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Why There Are So Many Programming Languages?" 3 | date: 2019-09-28 4 | draft: false 5 | --- 6 | 7 | Why hasn't anyone invented yet a Programming Language that would **catch them all**? 8 | 9 | Such question has stuck in my brain for quite some time, and none of the answers I found online were convincing. Then, I found an essay/video by Prof. Aiken, who teaches a class on Compilers at Stanford's Computer Science faculty. 10 | 11 | His point was so interesting that I want to elaborate it further. 12 | 13 | 14 | ## The "cost" of a Programming Language 15 | 16 | Let's start with a question that apparently hasn't got anything to do with the original question: What's the most expensive thing about a Programming Language? 17 | 18 | Let's say you were to create a new Programming Language today, and finishing up its development by tomorrow (a bit optimistic, I know). Now, what would the most expensive, and most difficult thing you have to do? 19 | 20 | Prof. Aiken makes a very interesting point here. He says that: 21 | 22 | _The most expensive thing of a Programming Language is the time it takes to programmers to learn it._ 23 | 24 | If you work in more than one programming language, then you know it's a lot of time indeed. However, **when a language is young** and there are only few programmers using it, **it can evolve very quickly** because it's easy to keep just a few developers updated with the novelties. Also, young languages are backed by small but extremely tight communities. This is another big boost to its development. 25 | 26 | ![Language Complexity vs Time to Learn](/images/timeToLearn.png) 27 | 28 | Think about well established languages, say Java and Python. For each of them there are hundreds of thousands of programmers using it, and therefore these languages evolve much more slowly. How much time there is between two consecutive Java, or Python, releases? 29 | 30 | Thus, famous and solid programming languages are **slower to adapt** to new needs that arise from new technologies. 31 | 32 | Therefore, quite paradoxically, **creating a new language is a faster way** to support such new needs, as well as gathering new users and creating a new community of programmers around the new language. 33 | 34 | I'd like to share two examples from my own daily practice at work. 35 | 36 | ## A new language, just for statistician? 37 | 38 | Let's consider R, the "language for statisticians". It's an extension of an old language, called S, created at the Bell Labs. R, instead, was originally implemented at the University of Auckland, New Zealand. 39 | 40 | Would you say it is not possible to support statistics computation in Python, Java or C? Of course it is. And actually there's a well known package for Python, `scipy.stats`, oriented towards statistics. 41 | 42 | However, adapting Java or C in order to make them easy-to-use for statisticians would require a lot of time. In this sense, the scipy.stats package is a perfect example: even though it works well (and let's assume it's well designed internally), its interface for the programmer (that is, the syntax and the libraries) is nowhere as neat as R's interface. I personally find `scipy.stats` really clumsy to use for statistics. R is almost perfect. 43 | 44 | This is why R got a big traction (and quite some hype around it). All well deserved in my opinion. For example, it's the only programming language used in the fantastic Data Science specialization offered on Coursera by the Johns Hopkins University. 45 | 46 | So, all good for a long while. What happened then? In my opinion, things went a bit out of control. 47 | 48 | R's aficionados thought - Hey why don't we get out of the statisticians world? We can use R for a lot of other things! 49 | 50 | The result was a bunch of pseudo- software products written in R. Today, you can really find anything in R: web servers, http and websocket clients, maybe even some GUI library. 51 | 52 | The undeniable fact is that R wasn't designed for these applications. This, along with the fact that they weren't built by professional software developers, makes these software products not very well designed, again in my modest opinion. 53 | 54 | At any rate, the simple evidence is that R has evolved into a **full-fledged programming language**, regardless of the quality of the libraries for things outside of the statistic scope. Hence, we have a new general-purpose programming language alongside the more classic C++, Java, etc. 55 | 56 | If you think R's story is an exception, then think again! Lots of other Programming Languages have seen the same happening to them. 57 | 58 | ## A new language, just for automation? 59 | 60 | A language I've worked with for a long time is Matlab. It's a proprietary programming language, owned by MathWorks, that was designed to seamlessly integrate with a set of other software tools developed by the same company. Main use cases: dynamic system simulations, automotive and feedback control. 61 | 62 | Even though these applications are not too common within the Computer Science world, and even though Matlab is not too common of a language either, I think it's a good example in this context. 63 | 64 | Matlab is, once more, in my opinion, not the best programming language out there, if used for general-purpose software development. Memory management, OOP, and many other features are almost senseless therein. 65 | 66 | However, **it's just perfect for dynamic systems simulations and control applications**. And that's why is the de-facto tool in this industry. 67 | 68 | If you think that numpy + scipy is a good competitor, then, well, I bet you've never really used Matlab. 69 | 70 | Matlab's story is quite similar to R's. A great product, enormously useful to people working in the related field. MathWorks built something really great. 71 | 72 | But then people started doing the weirdest thing with it, and things went, ironically, out of control! 73 | 74 | ## Conclusions 75 | 76 | Programming Languages history is a fascinating topic! From FORTRAN, for which arguably the first real Compiler was built, to C - simply put, a milestone in the Computer Science history. 77 | 78 | Modern languages history is also very interesting, and also heavily influenced by the new trends and technologies that become public every day. 79 | 80 | Ultimately, the constant rise of new needs for such technologies, and the big amount of time it would take for "old" languages to adapt and address these needs, are the reasons why we have so many programming languages out there. 81 | 82 | 83 | ## References 84 | 85 | R programming language: [A Brief History](https://en.wikipedia.org/wiki/R_(programming_language)#History) (Wikipedia page). 86 | 87 | MATLAB programming language: [A Brief History](https://en.wikipedia.org/wiki/MATLAB#History) (Wikipedia page). 88 | 89 | Prof. Aiken [personal page](http://theory.stanford.edu/~aiken/) at Stanford University. 90 | -------------------------------------------------------------------------------- /class/content/page/why-some-programming-language-is-faster.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Why Are Some Programming Languages Faster?" 3 | date: 2019-10-12 4 | draft: false 5 | --- 6 | 7 | Thanks to "Compilers" being the main keyword for this course, we also learned a great deal about Programming Language. 8 | 9 | In a previous article I described what features can differentiate a programming language from the others. In particular: 10 | 11 | - General Purpose vs Domain Specific Language. 12 | - High vs Low Level Language. 13 | - Interpreted vs Compiled Language. 14 | - Procedural vs Functional vs Object Oriented Language. 15 | - Typed vs Untyped Language. 16 | - Statically vs Dynamically Typed Language. 17 | - Static vs Dynamic Scope. 18 | - Automatically Managed Memory (Garbage Collector) vs Manual Memory Management. 19 | 20 | These are core features design of a language. The person (or the team) that works on that language development, and its compiler, has to make a choice for each of the above points, and even more. 21 | 22 | As a result, there are a lot of Programming Languages out there. Each Language has its unique set of features, although, in all honesty, some languages are really similar. 23 | 24 | A common question is **what's the fastest programming language**? 25 | 26 | First of all, the question asked in this form makes little sense. For a number of reasons: 27 | 28 | - The quality of your code is more important than the efficiency of the language you use, for 99.9% of applications. 29 | - Actual speed of execution strongly depends on the hardware, and not just on the programming language. 30 | - Even on the same hardware, the current CPUs and RAM are such that in a tiny percentage of cases you will experience a performance difference due to the programming language. 31 | - There are many things that you can't know about how the Compiler modifies your code, to optimize the execution. I talked about them in a previous article. 32 | 33 | In different words, much before thinking about the performance of the language you chose, and of its compiler, you should focus on different things, much more important: 34 | 35 | 1. Write the highest-quality code you can. 36 | 3. Use standard, well-known software pattern design. They improve readability and overall maintenance of the code, hence performance. 37 | 4. Choose well tested, robust, external libraries and packages if you need any. 38 | 39 | That said, the main question still stands, and it's an interesting one from a theoretical point of view. 40 | 41 | **If we could implement the same algorithm, on the same hardware, with all other conditions being the same, in different Programming Languages, which would be the fastest?** 42 | 43 | To answer that, and in view of all other important points I mentioned, I want to discuss **the top-3 features that impact the efficiency**. 44 | 45 | ## Assembled vs Compiled vs Interpreted 46 | 47 | In fact, there's little doubt. _Assembled code is the fastest_. 48 | 49 | Speaking from a theoretical point of view, if you could always write your programs in Assembly code, and you could also always write the best Assembly code that's possible, then yes, your Assembly code would always be the fastest. 50 | 51 | That's because Assembly code doesn't need to pass through a Compiler. It's directly assembled into CPU instructions. Blazing fast. 52 | 53 | Needless to say, that's quite a lot of hypotheses. 54 | 55 | First of all, most modern programs would be painful to write in Assembly. 56 | 57 | Secondly, very few programmers are trained to write efficient Assembly code. This is a direct consequence of the previous point. Therefore, it's highly possible that a good code, say in C, compiled with a good Compiler becomes more efficient than a poorly written Assembly code. 58 | 59 | In other words, if you are not an Assembly developer, then a good Compiler can written better Assembly code than you, even if it's just a software! 60 | 61 | If you don't want to write Assembly code, then again, one can make an educated statement: **Compiled code is the second fastest** (among the three types we are discussing). 62 | 63 | Briefly explained, the reason is that Compilers produce so-called "target code", that's basically machine code. On the other hand, Interpreters add one more layer between the execution environment for your program, and the Operating System, and that slows things down a bit. 64 | 65 | ## Abstraction 66 | 67 | Why is C that fast? 68 | 69 | As a programming language, C doesn't offer you anything special. 70 | 71 | - There are no class and inheritance. 72 | - There is no dynamic typing. 73 | - Arrays boundaries are not checked (you don't know the length of an array a-priori). 74 | - There's nothing cleaning up memory after you (you must do it manually). 75 | 76 | In other words, C code is just a little bit more abstract than Assembly code. This allows a very good C developer to write highly efficient code. 77 | 78 | On the other hand, C code is not really safe. Every time you perform an operation on the computer memory, for example using memcpy, it's not even checked what was before in that memory locations, and if there's any overlap. Trust the programmer is C's spirit. 79 | 80 | Other languages provide more abstraction and more security. 81 | 82 | To start with, all OOP Languages allow us to define complex objects and new types, along with the operation that one can use on them. 83 | 84 | Then, things like the Java Virtual Machine (or Python's interpreter) make the program execution overall much safer. But, they do spend some time to perform security checks, during the execution itself. 85 | 86 | It must be said that Just-In-Time compilers exist for many languages, and they give great performance improvements. But that's an entirely different topic. 87 | 88 | ## Tie with the Application 89 | 90 | If you work on an application and could write for it a C program that takes 1 week to write and runs in 0.1 seconds, or a Python program that takes 1 day to write, and runs in 5 seconds, which option would you choose? 91 | 92 | I guess it really depends on the actual application. 93 | 94 | If the program is meant to run once a day, then maybe it doesn't matter how fast it is. 95 | 96 | But if you must run it 100.000+ times a day, on several machines, then the CPU-time on these machines would be very different if you sue C or if you use Python. And so would be the total power consumption of your computers, which means money. In this case, spending one week writing good C code can save you lots of money. 97 | 98 | The point I am making here is that execution speed is often a relative concept. Other factors play an important role, such as how much speed do you really need, what's the benefit of some speed improvement, as well as the trade-off between execution speed and development speed. 99 | 100 | ## But so, Which Programming Language is the Fastest?! 101 | 102 | I purposefully avoided to give a firm answer on this question in the previous part of this article, because I think this is not the correct design question to ask when building something. 103 | 104 | That said, if you really can't resist, just know that C is usually taken as reference point. 105 | 106 | That means that performances of new languages are evaluated by comparing execution of standard algorithms with the runtime of the same algorithms implemented in C. 107 | 108 | According to many sources (that you can google yourself) C, Rust, C++ and Fortran are always at the top of the many ratings for the fastest programming language. 109 | 110 | As additional study, I warmly recommend to check you the link in the references to the page Bad Code Can Be Written In Any Language. 111 | 112 | To conclude. _Which programming language is fastest? Should we care? How could we know?_ (from [The Benchmarks Game](https://benchmarksgame-team.pages.debian.net/benchmarksgame/which-programs-are-fastest.html)). 113 | 114 | ## References 115 | 116 | My article [What are the differences between programming languages?]({{< ref "/page/what-are-the-differences-in-programming-languages.md" >}}). 117 | -------------------------------------------------------------------------------- /class/resources/_gen/assets/scss/scss/main.scss_76ac6956597c32fec7ddf60d408db3ab.json: -------------------------------------------------------------------------------- 1 | {"Target":"css/academic.css","MediaType":"text/css","Data":{}} -------------------------------------------------------------------------------- /class/resources/_gen/images/home/gallery/gallery/theme-1950s_huaf5482f8cea0c5a703a328640e3b7509_21614_0x190_resize_lanczos_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/resources/_gen/images/home/gallery/gallery/theme-1950s_huaf5482f8cea0c5a703a328640e3b7509_21614_0x190_resize_lanczos_2.png -------------------------------------------------------------------------------- /class/resources/_gen/images/home/gallery/gallery/theme-apogee_hu4b45d99db97150df01464c393bfd17d4_24119_0x190_resize_lanczos_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/resources/_gen/images/home/gallery/gallery/theme-apogee_hu4b45d99db97150df01464c393bfd17d4_24119_0x190_resize_lanczos_2.png -------------------------------------------------------------------------------- /class/resources/_gen/images/home/gallery/gallery/theme-coffee-playfair_hu446a8f670cc5622adcc77b97ba95f6c5_22462_0x190_resize_lanczos_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/resources/_gen/images/home/gallery/gallery/theme-coffee-playfair_hu446a8f670cc5622adcc77b97ba95f6c5_22462_0x190_resize_lanczos_2.png -------------------------------------------------------------------------------- /class/resources/_gen/images/home/gallery/gallery/theme-dark_hu1e8601ecc47f58eada7743fdcd709d3d_21456_0x190_resize_lanczos_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/resources/_gen/images/home/gallery/gallery/theme-dark_hu1e8601ecc47f58eada7743fdcd709d3d_21456_0x190_resize_lanczos_2.png -------------------------------------------------------------------------------- /class/resources/_gen/images/home/gallery/gallery/theme-default_huba6228b7bdf30e2f03f12ea91b2cba0d_21751_0x190_resize_lanczos_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/resources/_gen/images/home/gallery/gallery/theme-default_huba6228b7bdf30e2f03f12ea91b2cba0d_21751_0x190_resize_lanczos_2.png -------------------------------------------------------------------------------- /class/resources/_gen/images/home/gallery/gallery/theme-forest_hu4f093a1c683134431456584193ea41ee_21797_0x190_resize_lanczos_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/resources/_gen/images/home/gallery/gallery/theme-forest_hu4f093a1c683134431456584193ea41ee_21797_0x190_resize_lanczos_2.png -------------------------------------------------------------------------------- /class/resources/_gen/images/home/gallery/gallery/theme-ocean_hu14831ccafc2219f30a7a096fa7617e01_21760_0x190_resize_lanczos_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/resources/_gen/images/home/gallery/gallery/theme-ocean_hu14831ccafc2219f30a7a096fa7617e01_21760_0x190_resize_lanczos_2.png -------------------------------------------------------------------------------- /class/resources/_gen/images/home/gallery/gallery/theme-strawberry_hu36b0b347fcca08bd39e2df22dcedbdfb_39532_0x190_resize_lanczos_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/resources/_gen/images/home/gallery/gallery/theme-strawberry_hu36b0b347fcca08bd39e2df22dcedbdfb_39532_0x190_resize_lanczos_2.png -------------------------------------------------------------------------------- /class/resources/_gen/images/images/icon_hu0b7a4cb9992c9ac0e91bd28ffd38dd00_9727_192x192_fill_lanczos_center_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/resources/_gen/images/images/icon_hu0b7a4cb9992c9ac0e91bd28ffd38dd00_9727_192x192_fill_lanczos_center_2.png -------------------------------------------------------------------------------- /class/resources/_gen/images/images/icon_hu0b7a4cb9992c9ac0e91bd28ffd38dd00_9727_32x32_fill_lanczos_center_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/resources/_gen/images/images/icon_hu0b7a4cb9992c9ac0e91bd28ffd38dd00_9727_32x32_fill_lanczos_center_2.png -------------------------------------------------------------------------------- /class/resources/_gen/images/images/icon_hu0b7a4cb9992c9ac0e91bd28ffd38dd00_9727_512x512_fill_lanczos_center_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/resources/_gen/images/images/icon_hu0b7a4cb9992c9ac0e91bd28ffd38dd00_9727_512x512_fill_lanczos_center_2.png -------------------------------------------------------------------------------- /class/static/css/syntax.css: -------------------------------------------------------------------------------- 1 | /* Background */ .chroma { background-color: #ffffff } 2 | /* Error */ .chroma .err { color: #a61717; background-color: #e3d2d2 } 3 | /* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; } 4 | /* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; width: auto; overflow: auto; display: block; } 5 | /* LineHighlight */ .chroma .hl { display: block; width: 100%;background-color: #ffffcc } 6 | /* LineNumbersTable */ .chroma .lnt { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f } 7 | /* LineNumbers */ .chroma .ln { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f } 8 | /* Keyword */ .chroma .k { font-weight: bold } 9 | /* KeywordConstant */ .chroma .kc { font-weight: bold } 10 | /* KeywordDeclaration */ .chroma .kd { font-weight: bold } 11 | /* KeywordNamespace */ .chroma .kn { font-weight: bold } 12 | /* KeywordPseudo */ .chroma .kp { font-weight: bold } 13 | /* KeywordReserved */ .chroma .kr { font-weight: bold } 14 | /* KeywordType */ .chroma .kt { color: #445588; font-weight: bold } 15 | /* NameAttribute */ .chroma .na { color: #008080 } 16 | /* NameBuiltin */ .chroma .nb { color: #999999 } 17 | /* NameClass */ .chroma .nc { color: #445588; font-weight: bold } 18 | /* NameConstant */ .chroma .no { color: #008080 } 19 | /* NameEntity */ .chroma .ni { color: #800080 } 20 | /* NameException */ .chroma .ne { color: #990000; font-weight: bold } 21 | /* NameFunction */ .chroma .nf { color: #990000; font-weight: bold } 22 | /* NameNamespace */ .chroma .nn { color: #555555 } 23 | /* NameTag */ .chroma .nt { color: #000080 } 24 | /* NameVariable */ .chroma .nv { color: #008080 } 25 | /* LiteralString */ .chroma .s { color: #bb8844 } 26 | /* LiteralStringAffix */ .chroma .sa { color: #bb8844 } 27 | /* LiteralStringBacktick */ .chroma .sb { color: #bb8844 } 28 | /* LiteralStringChar */ .chroma .sc { color: #bb8844 } 29 | /* LiteralStringDelimiter */ .chroma .dl { color: #bb8844 } 30 | /* LiteralStringDoc */ .chroma .sd { color: #bb8844 } 31 | /* LiteralStringDouble */ .chroma .s2 { color: #bb8844 } 32 | /* LiteralStringEscape */ .chroma .se { color: #bb8844 } 33 | /* LiteralStringHeredoc */ .chroma .sh { color: #bb8844 } 34 | /* LiteralStringInterpol */ .chroma .si { color: #bb8844 } 35 | /* LiteralStringOther */ .chroma .sx { color: #bb8844 } 36 | /* LiteralStringRegex */ .chroma .sr { color: #808000 } 37 | /* LiteralStringSingle */ .chroma .s1 { color: #bb8844 } 38 | /* LiteralStringSymbol */ .chroma .ss { color: #bb8844 } 39 | /* LiteralNumber */ .chroma .m { color: #009999 } 40 | /* LiteralNumberBin */ .chroma .mb { color: #009999 } 41 | /* LiteralNumberFloat */ .chroma .mf { color: #009999 } 42 | /* LiteralNumberHex */ .chroma .mh { color: #009999 } 43 | /* LiteralNumberInteger */ .chroma .mi { color: #009999 } 44 | /* LiteralNumberIntegerLong */ .chroma .il { color: #009999 } 45 | /* LiteralNumberOct */ .chroma .mo { color: #009999 } 46 | /* Operator */ .chroma .o { font-weight: bold } 47 | /* OperatorWord */ .chroma .ow { font-weight: bold } 48 | /* Comment */ .chroma .c { color: #999988; font-style: italic } 49 | /* CommentHashbang */ .chroma .ch { color: #999988; font-style: italic } 50 | /* CommentMultiline */ .chroma .cm { color: #999988; font-style: italic } 51 | /* CommentSingle */ .chroma .c1 { color: #999988; font-style: italic } 52 | /* CommentSpecial */ .chroma .cs { color: #999999; font-weight: bold; font-style: italic } 53 | /* CommentPreproc */ .chroma .cp { color: #999999; font-weight: bold } 54 | /* CommentPreprocFile */ .chroma .cpf { color: #999999; font-weight: bold } 55 | /* GenericDeleted */ .chroma .gd { color: #000000; background-color: #ffdddd } 56 | /* GenericEmph */ .chroma .ge { font-style: italic } 57 | /* GenericError */ .chroma .gr { color: #aa0000 } 58 | /* GenericHeading */ .chroma .gh { color: #999999 } 59 | /* GenericInserted */ .chroma .gi { color: #000000; background-color: #ddffdd } 60 | /* GenericOutput */ .chroma .go { color: #888888 } 61 | /* GenericPrompt */ .chroma .gp { color: #555555 } 62 | /* GenericStrong */ .chroma .gs { font-weight: bold } 63 | /* GenericSubheading */ .chroma .gu { color: #aaaaaa } 64 | /* GenericTraceback */ .chroma .gt { color: #aa0000 } 65 | /* GenericUnderline */ .chroma .gl { text-decoration: underline } 66 | /* TextWhitespace */ .chroma .w { color: #bbbbbb } 67 | -------------------------------------------------------------------------------- /class/static/images/DFA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/static/images/DFA.png -------------------------------------------------------------------------------- /class/static/images/ParserClassification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/static/images/ParserClassification.png -------------------------------------------------------------------------------- /class/static/images/WebApiDsl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/static/images/WebApiDsl.png -------------------------------------------------------------------------------- /class/static/images/exampleParseTree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/static/images/exampleParseTree.png -------------------------------------------------------------------------------- /class/static/images/memory1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/static/images/memory1.png -------------------------------------------------------------------------------- /class/static/images/memory2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/static/images/memory2.png -------------------------------------------------------------------------------- /class/static/images/memory3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/static/images/memory3.png -------------------------------------------------------------------------------- /class/static/images/numDevelopers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/static/images/numDevelopers.png -------------------------------------------------------------------------------- /class/static/images/parseTree2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/static/images/parseTree2.png -------------------------------------------------------------------------------- /class/static/images/parseTree3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/static/images/parseTree3.png -------------------------------------------------------------------------------- /class/static/images/stepsBuildCompiler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/static/images/stepsBuildCompiler.png -------------------------------------------------------------------------------- /class/static/images/timeToLearn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/class/static/images/timeToLearn.png -------------------------------------------------------------------------------- /code.e: -------------------------------------------------------------------------------- 1 | readInt N; 2 | totSum = 0; 3 | i = 0; 4 | while (i <= N) 5 | j = 2; 6 | isPrime = True; 7 | while ((j <= i / 2) && isPrime) 8 | if (i % j == 0) 9 | writeOut "%s is not prime", i; 10 | isPrime = False; 11 | ; 12 | j = j + 1; 13 | ; 14 | if (isPrime) 15 | totSum = totSum + i; 16 | ; 17 | i = i + 1; 18 | ; 19 | writeOut "Total primes sum until %s is %s", N, totSum; 20 | -------------------------------------------------------------------------------- /docs/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 404 Page not found | Compilers 11 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 94 | 95 | 96 | 97 | 98 | 99 | 100 |
101 |
102 |

103 |

Whoops, this page doesn't exist. Move along. (404 error)

104 |
105 |
106 | 115 | 116 | 117 | 161 | 162 | 179 | 180 | 181 | 182 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | -------------------------------------------------------------------------------- /docs/categories/index.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Categories on Compilers 5 | https://pgrandinetti.github.io/compilers/categories/ 6 | Recent content in Categories on Compilers 7 | Hugo -- gohugo.io 8 | en-us 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/css/codeblock.css: -------------------------------------------------------------------------------- 1 | /* --- Code blocks --- */ 2 | 3 | .chroma .ln { 4 | margin-right: 0.8em; 5 | padding: 0 0.4em 0 0.4em; 6 | } 7 | pre code.hljs { 8 | padding: 9.5px; 9 | } 10 | 11 | .highlight tr, .highlight pre { 12 | border: none; 13 | } 14 | 15 | .highlight div:first-child { 16 | border-radius: 4px; 17 | } 18 | 19 | .highlight td:first-child pre, .highlight pre { 20 | border-top-left-radius: 4px; 21 | border-top-right-radius: unset; 22 | border-bottom-left-radius: 4px; 23 | border-bottom-right-radius: unset; 24 | overflow: hidden; 25 | } 26 | 27 | .highlight td:last-child pre, .highlight pre { 28 | border-radius: unset; 29 | } 30 | 31 | .highlight td:last-child pre code, .highlight pre code { 32 | white-space: pre; 33 | } -------------------------------------------------------------------------------- /docs/css/default-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/default-skin.png -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_AMS-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_AMS-Regular.ttf -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_AMS-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_AMS-Regular.woff -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_AMS-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_AMS-Regular.woff2 -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Caligraphic-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Caligraphic-Bold.ttf -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Caligraphic-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Caligraphic-Bold.woff -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Caligraphic-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Caligraphic-Bold.woff2 -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Caligraphic-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Caligraphic-Regular.ttf -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Caligraphic-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Caligraphic-Regular.woff -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Caligraphic-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Caligraphic-Regular.woff2 -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Fraktur-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Fraktur-Bold.ttf -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Fraktur-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Fraktur-Bold.woff -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Fraktur-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Fraktur-Bold.woff2 -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Fraktur-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Fraktur-Regular.ttf -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Fraktur-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Fraktur-Regular.woff -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Fraktur-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Fraktur-Regular.woff2 -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Main-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Main-Bold.ttf -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Main-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Main-Bold.woff -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Main-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Main-Bold.woff2 -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Main-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Main-BoldItalic.ttf -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Main-BoldItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Main-BoldItalic.woff -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Main-BoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Main-BoldItalic.woff2 -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Main-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Main-Italic.ttf -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Main-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Main-Italic.woff -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Main-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Main-Italic.woff2 -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Main-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Main-Regular.ttf -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Main-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Main-Regular.woff -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Main-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Main-Regular.woff2 -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Math-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Math-BoldItalic.ttf -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Math-BoldItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Math-BoldItalic.woff -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Math-BoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Math-BoldItalic.woff2 -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Math-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Math-Italic.ttf -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Math-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Math-Italic.woff -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Math-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Math-Italic.woff2 -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_SansSerif-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_SansSerif-Bold.ttf -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_SansSerif-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_SansSerif-Bold.woff -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_SansSerif-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_SansSerif-Bold.woff2 -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_SansSerif-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_SansSerif-Italic.ttf -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_SansSerif-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_SansSerif-Italic.woff -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_SansSerif-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_SansSerif-Italic.woff2 -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_SansSerif-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_SansSerif-Regular.ttf -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_SansSerif-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_SansSerif-Regular.woff -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_SansSerif-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_SansSerif-Regular.woff2 -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Script-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Script-Regular.ttf -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Script-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Script-Regular.woff -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Script-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Script-Regular.woff2 -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Size1-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Size1-Regular.ttf -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Size1-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Size1-Regular.woff -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Size1-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Size1-Regular.woff2 -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Size2-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Size2-Regular.ttf -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Size2-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Size2-Regular.woff -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Size2-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Size2-Regular.woff2 -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Size3-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Size3-Regular.ttf -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Size3-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Size3-Regular.woff -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Size3-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Size3-Regular.woff2 -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Size4-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Size4-Regular.ttf -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Size4-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Size4-Regular.woff -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Size4-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Size4-Regular.woff2 -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Typewriter-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Typewriter-Regular.ttf -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Typewriter-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Typewriter-Regular.woff -------------------------------------------------------------------------------- /docs/css/fonts/KaTeX_Typewriter-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/css/fonts/KaTeX_Typewriter-Regular.woff2 -------------------------------------------------------------------------------- /docs/css/highlight.min.css: -------------------------------------------------------------------------------- 1 | .hljs{display:block;overflow-x:auto;padding:0.5em;color:#333;background:#f8f8f8}.hljs-comment,.hljs-quote{color:#998;font-style:italic}.hljs-keyword,.hljs-selector-tag,.hljs-subst{color:#333;font-weight:bold}.hljs-number,.hljs-literal,.hljs-variable,.hljs-template-variable,.hljs-tag .hljs-attr{color:#008080}.hljs-string,.hljs-doctag{color:#d14}.hljs-title,.hljs-section,.hljs-selector-id{color:#900;font-weight:bold}.hljs-subst{font-weight:normal}.hljs-type,.hljs-class .hljs-title{color:#458;font-weight:bold}.hljs-tag,.hljs-name,.hljs-attribute{color:#000080;font-weight:normal}.hljs-regexp,.hljs-link{color:#009926}.hljs-symbol,.hljs-bullet{color:#990073}.hljs-built_in,.hljs-builtin-name{color:#0086b3}.hljs-meta{color:#999;font-weight:bold}.hljs-deletion{background:#fdd}.hljs-addition{background:#dfd}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:bold} -------------------------------------------------------------------------------- /docs/css/hugo-easy-gallery.css: -------------------------------------------------------------------------------- 1 | /* 2 | Put this file in /static/css/hugo-easy-gallery.css 3 | Documentation and licence at https://github.com/liwenyip/hugo-easy-gallery/ 4 | */ 5 | 6 | 7 | /* 8 | Grid Layout Styles 9 | */ 10 | .gallery { 11 | overflow: hidden; 12 | margin: 10px; 13 | max-width: 768px; 14 | } 15 | .gallery .box { 16 | float: left; 17 | position: relative; 18 | /* Default: 1 tile wide */ 19 | width: 100%; 20 | padding-bottom: 100%; 21 | } 22 | @media only screen and (min-width : 365px) { 23 | /* Tablet view: 2 tiles */ 24 | .gallery .box { 25 | width: 50%; 26 | padding-bottom: 50%; 27 | } 28 | } 29 | @media only screen and (min-width : 480px) { 30 | /* Small desktop / ipad view: 3 tiles */ 31 | .gallery .box { 32 | width: 33.3%; 33 | padding-bottom: 33.3%; /* */ 34 | } 35 | } 36 | @media only screen and (min-width : 9999px) { 37 | /* Medium desktop: 4 tiles */ 38 | .box { 39 | width: 25%; 40 | padding-bottom: 25%; 41 | } 42 | } 43 | 44 | /* 45 | Transition styles 46 | */ 47 | .gallery.hover-transition figure, 48 | .gallery.hover-effect-zoom .img, 49 | .gallery:not(.caption-effect-appear) figcaption, 50 | .fancy-figure:not(.caption-effect-appear) figcaption { 51 | -webkit-transition: all 0.3s ease-in-out; 52 | -moz-transition: all 0.3s ease-in-out; 53 | -o-transition: all 0.3s ease-in-out; 54 | transition: all 0.3s ease-in-out; 55 | } 56 | /* 57 | figure styles 58 | */ 59 | figure { 60 | position:relative; /* purely to allow absolution positioning of figcaption */ 61 | overflow: hidden; 62 | } 63 | .gallery figure { 64 | position: absolute; 65 | left: 5px; 66 | right: 5px; 67 | top: 5px; 68 | bottom: 5px; 69 | } 70 | .gallery.hover-effect-grow figure:hover { 71 | transform: scale(1.05); 72 | } 73 | .gallery.hover-effect-shrink figure:hover { 74 | transform: scale(0.95); 75 | } 76 | .gallery.hover-effect-slidedown figure:hover { 77 | transform: translateY(5px); 78 | } 79 | .gallery.hover-effect-slideup figure:hover { 80 | transform: translateY(-5px); 81 | } 82 | 83 | /* 84 | img / a styles 85 | */ 86 | 87 | .gallery .img { 88 | position: absolute; 89 | left: 0; 90 | right: 0; 91 | top: 0; 92 | bottom: 0; 93 | background-size: cover; 94 | background-position: 50% 50%; 95 | background-repeat: no-repeat; 96 | } 97 | .gallery.hover-effect-zoom figure:hover .img { 98 | transform: scale(1.05); 99 | } 100 | .gallery img { 101 | display: none; /* only show the img if not inside a gallery */ 102 | } 103 | figure a { 104 | position: absolute; 105 | left: 0; 106 | right: 0; 107 | top: 0; 108 | bottom: 0; 109 | } 110 | 111 | /* 112 | figcaption styles 113 | */ 114 | .gallery figcaption, 115 | .fancy-figure figcaption { 116 | position: absolute; 117 | bottom: 0; 118 | left: 0; 119 | right: 0; 120 | background: #000; 121 | color: #FFF; 122 | text-align: center; 123 | font-size: 75%; /* change this if you want bigger text */ 124 | background: rgba(0, 0, 0, 0.5); 125 | opacity: 1; 126 | cursor: pointer; 127 | } 128 | .gallery.caption-position-none figcaption, 129 | .fancy-figure.caption-position-none figcaption { 130 | display: none; 131 | } 132 | .gallery.caption-position-center figcaption, 133 | .fancy-figure.caption-position-center figcaption { 134 | top: 0; 135 | padding: 40% 5px; 136 | } 137 | .gallery.caption-position-bottom figcaption, 138 | .fancy-figure.caption-position-bottom figcaption { 139 | padding: 5px; 140 | } 141 | .gallery.caption-effect-fade figure:not(:hover) figcaption, 142 | .gallery.caption-effect-appear figure:not(:hover) figcaption, 143 | .fancy-figure.caption-effect-fade figure:not(:hover) figcaption, 144 | .fancy-figure.caption-effect-appear figure:not(:hover) figcaption { 145 | background: rgba(0, 0, 0, 0); 146 | opacity: 0; 147 | } 148 | .gallery.caption-effect-slide.caption-position-bottom figure:not(:hover) figcaption, 149 | .fancy-figure.caption-effect-slide.caption-position-bottom figure:not(:hover) figcaption { 150 | margin-bottom: -100%; 151 | } 152 | .gallery.caption-effect-slide.caption-position-center figure:not(:hover) figcaption, 153 | .fancy-figure.caption-effect-slide.caption-position-center figure:not(:hover) figcaption { 154 | top: 100%; 155 | } 156 | figcaption p { 157 | margin: auto; /* override style in theme */ 158 | } 159 | 160 | -------------------------------------------------------------------------------- /docs/css/main-minimal.css: -------------------------------------------------------------------------------- 1 | .main-content { 2 | padding-bottom: 50px; 3 | } 4 | 5 | footer.footer-min { 6 | position: fixed; 7 | bottom: 0; 8 | width: 100%; 9 | padding: 3px; 10 | background-color: #f5f5f5; 11 | border-top: 1px solid #eeeeee; 12 | text-align: center; 13 | } -------------------------------------------------------------------------------- /docs/css/mermaid.css: -------------------------------------------------------------------------------- 1 | /* Flowchart variables */ 2 | /* Sequence Diagram variables */ 3 | /* Gantt chart variables */ 4 | .mermaid .label { 5 | color: #333; 6 | } 7 | .node rect, 8 | .node circle, 9 | .node ellipse, 10 | .node polygon { 11 | fill: #ECECFF; 12 | stroke: #CCCCFF; 13 | stroke-width: 1px; 14 | } 15 | .edgePath .path { 16 | stroke: #333333; 17 | } 18 | .edgeLabel { 19 | background-color: #e8e8e8; 20 | } 21 | .cluster rect { 22 | fill: #ffffde !important; 23 | rx: 4 !important; 24 | stroke: #aaaa33 !important; 25 | stroke-width: 1px !important; 26 | } 27 | .cluster text { 28 | fill: #333; 29 | } 30 | .actor { 31 | stroke: #CCCCFF; 32 | fill: #ECECFF; 33 | } 34 | text.actor { 35 | fill: black; 36 | stroke: none; 37 | } 38 | .actor-line { 39 | stroke: grey; 40 | } 41 | .messageLine0 { 42 | stroke-width: 1.5; 43 | stroke-dasharray: "2 2"; 44 | marker-end: "url(#arrowhead)"; 45 | stroke: #333; 46 | } 47 | .messageLine1 { 48 | stroke-width: 1.5; 49 | stroke-dasharray: "2 2"; 50 | stroke: #333; 51 | } 52 | #arrowhead { 53 | fill: #333; 54 | } 55 | #crosshead path { 56 | fill: #333 !important; 57 | stroke: #333 !important; 58 | } 59 | .messageText { 60 | fill: #333; 61 | stroke: none; 62 | } 63 | .labelBox { 64 | stroke: #CCCCFF; 65 | fill: #ECECFF; 66 | } 67 | .labelText { 68 | fill: black; 69 | stroke: none; 70 | } 71 | .loopText { 72 | fill: black; 73 | stroke: none; 74 | } 75 | .loopLine { 76 | stroke-width: 2; 77 | stroke-dasharray: "2 2"; 78 | marker-end: "url(#arrowhead)"; 79 | stroke: #CCCCFF; 80 | } 81 | .note { 82 | stroke: #aaaa33; 83 | fill: #fff5ad; 84 | } 85 | .noteText { 86 | fill: black; 87 | stroke: none; 88 | font-family: 'trebuchet ms', verdana, arial; 89 | font-size: 14px; 90 | } 91 | /** Section styling */ 92 | .section { 93 | stroke: none; 94 | opacity: 0.2; 95 | } 96 | .section0 { 97 | fill: rgba(102, 102, 255, 0.49); 98 | } 99 | .section2 { 100 | fill: #fff400; 101 | } 102 | .section1, 103 | .section3 { 104 | fill: white; 105 | opacity: 0.2; 106 | } 107 | .sectionTitle0 { 108 | fill: #333; 109 | } 110 | .sectionTitle1 { 111 | fill: #333; 112 | } 113 | .sectionTitle2 { 114 | fill: #333; 115 | } 116 | .sectionTitle3 { 117 | fill: #333; 118 | } 119 | .sectionTitle { 120 | text-anchor: start; 121 | font-size: 11px; 122 | text-height: 14px; 123 | } 124 | /* Grid and axis */ 125 | .grid .tick { 126 | stroke: lightgrey; 127 | opacity: 0.3; 128 | shape-rendering: crispEdges; 129 | } 130 | .grid path { 131 | stroke-width: 0; 132 | } 133 | /* Today line */ 134 | .today { 135 | fill: none; 136 | stroke: red; 137 | stroke-width: 2px; 138 | } 139 | /* Task styling */ 140 | /* Default task */ 141 | .task { 142 | stroke-width: 2; 143 | } 144 | .taskText { 145 | text-anchor: middle; 146 | font-size: 11px; 147 | } 148 | .taskTextOutsideRight { 149 | fill: black; 150 | text-anchor: start; 151 | font-size: 11px; 152 | } 153 | .taskTextOutsideLeft { 154 | fill: black; 155 | text-anchor: end; 156 | font-size: 11px; 157 | } 158 | /* Specific task settings for the sections*/ 159 | .taskText0, 160 | .taskText1, 161 | .taskText2, 162 | .taskText3 { 163 | fill: white; 164 | } 165 | .task0, 166 | .task1, 167 | .task2, 168 | .task3 { 169 | fill: #8a90dd; 170 | stroke: #534fbc; 171 | } 172 | .taskTextOutside0, 173 | .taskTextOutside2 { 174 | fill: black; 175 | } 176 | .taskTextOutside1, 177 | .taskTextOutside3 { 178 | fill: black; 179 | } 180 | /* Active task */ 181 | .active0, 182 | .active1, 183 | .active2, 184 | .active3 { 185 | fill: #bfc7ff; 186 | stroke: #534fbc; 187 | } 188 | .activeText0, 189 | .activeText1, 190 | .activeText2, 191 | .activeText3 { 192 | fill: black !important; 193 | } 194 | /* Completed task */ 195 | .done0, 196 | .done1, 197 | .done2, 198 | .done3 { 199 | stroke: grey; 200 | fill: lightgrey; 201 | stroke-width: 2; 202 | } 203 | .doneText0, 204 | .doneText1, 205 | .doneText2, 206 | .doneText3 { 207 | fill: black !important; 208 | } 209 | /* Tasks on the critical line */ 210 | .crit0, 211 | .crit1, 212 | .crit2, 213 | .crit3 { 214 | stroke: #ff8888; 215 | fill: red; 216 | stroke-width: 2; 217 | } 218 | .activeCrit0, 219 | .activeCrit1, 220 | .activeCrit2, 221 | .activeCrit3 { 222 | stroke: #ff8888; 223 | fill: #bfc7ff; 224 | stroke-width: 2; 225 | } 226 | .doneCrit0, 227 | .doneCrit1, 228 | .doneCrit2, 229 | .doneCrit3 { 230 | stroke: #ff8888; 231 | fill: lightgrey; 232 | stroke-width: 2; 233 | cursor: pointer; 234 | shape-rendering: crispEdges; 235 | } 236 | .doneCritText0, 237 | .doneCritText1, 238 | .doneCritText2, 239 | .doneCritText3 { 240 | fill: black !important; 241 | } 242 | .activeCritText0, 243 | .activeCritText1, 244 | .activeCritText2, 245 | .activeCritText3 { 246 | fill: black !important; 247 | } 248 | .titleText { 249 | text-anchor: middle; 250 | font-size: 18px; 251 | fill: black; 252 | } 253 | /* 254 | */ 255 | .node text { 256 | font-family: 'trebuchet ms', verdana, arial; 257 | font-size: 14px; 258 | } 259 | div.mermaidTooltip { 260 | position: absolute; 261 | text-align: center; 262 | max-width: 200px; 263 | padding: 2px; 264 | font-family: 'trebuchet ms', verdana, arial; 265 | font-size: 12px; 266 | background: #ffffde; 267 | border: 1px solid #aaaa33; 268 | border-radius: 2px; 269 | pointer-events: none; 270 | z-index: 100; 271 | } -------------------------------------------------------------------------------- /docs/css/mermaid.dark.css: -------------------------------------------------------------------------------- 1 | /* Flowchart variables */ 2 | /* Sequence Diagram variables */ 3 | /* Gantt chart variables */ 4 | .mermaid .label { 5 | color: #323D47; 6 | } 7 | .node rect, 8 | .node circle, 9 | .node ellipse, 10 | .node polygon { 11 | fill: #BDD5EA; 12 | stroke: #81B1DB; 13 | stroke-width: 1px; 14 | } 15 | .edgePath .path { 16 | stroke: lightgrey; 17 | } 18 | .edgeLabel { 19 | background-color: #e8e8e8; 20 | } 21 | .cluster rect { 22 | fill: #6D6D65 !important; 23 | rx: 4 !important; 24 | stroke: rgba(255, 255, 255, 0.25) !important; 25 | stroke-width: 1px !important; 26 | } 27 | .cluster text { 28 | fill: #F9FFFE; 29 | } 30 | .actor { 31 | stroke: #81B1DB; 32 | fill: #BDD5EA; 33 | } 34 | text.actor { 35 | fill: black; 36 | stroke: none; 37 | } 38 | .actor-line { 39 | stroke: lightgrey; 40 | } 41 | .messageLine0 { 42 | stroke-width: 1.5; 43 | stroke-dasharray: "2 2"; 44 | marker-end: "url(#arrowhead)"; 45 | stroke: lightgrey; 46 | } 47 | .messageLine1 { 48 | stroke-width: 1.5; 49 | stroke-dasharray: "2 2"; 50 | stroke: lightgrey; 51 | } 52 | #arrowhead { 53 | fill: lightgrey !important; 54 | } 55 | #crosshead path { 56 | fill: lightgrey !important; 57 | stroke: lightgrey !important; 58 | } 59 | .messageText { 60 | fill: lightgrey; 61 | stroke: none; 62 | } 63 | .labelBox { 64 | stroke: #81B1DB; 65 | fill: #BDD5EA; 66 | } 67 | .labelText { 68 | fill: #323D47; 69 | stroke: none; 70 | } 71 | .loopText { 72 | fill: lightgrey; 73 | stroke: none; 74 | } 75 | .loopLine { 76 | stroke-width: 2; 77 | stroke-dasharray: "2 2"; 78 | marker-end: "url(#arrowhead)"; 79 | stroke: #81B1DB; 80 | } 81 | .note { 82 | stroke: rgba(255, 255, 255, 0.25); 83 | fill: #fff5ad; 84 | } 85 | .noteText { 86 | fill: black; 87 | stroke: none; 88 | font-family: 'trebuchet ms', verdana, arial; 89 | font-size: 14px; 90 | } 91 | /** Section styling */ 92 | .section { 93 | stroke: none; 94 | opacity: 0.2; 95 | } 96 | .section0 { 97 | fill: rgba(255, 255, 255, 0.3); 98 | } 99 | .section2 { 100 | fill: #EAE8B9; 101 | } 102 | .section1, 103 | .section3 { 104 | fill: white; 105 | opacity: 0.2; 106 | } 107 | .sectionTitle0 { 108 | fill: #F9FFFE; 109 | } 110 | .sectionTitle1 { 111 | fill: #F9FFFE; 112 | } 113 | .sectionTitle2 { 114 | fill: #F9FFFE; 115 | } 116 | .sectionTitle3 { 117 | fill: #F9FFFE; 118 | } 119 | .sectionTitle { 120 | text-anchor: start; 121 | font-size: 11px; 122 | text-height: 14px; 123 | } 124 | /* Grid and axis */ 125 | .grid .tick { 126 | stroke: rgba(255, 255, 255, 0.3); 127 | opacity: 0.3; 128 | shape-rendering: crispEdges; 129 | } 130 | .grid .tick text { 131 | fill: lightgrey; 132 | opacity: 0.5; 133 | } 134 | .grid path { 135 | stroke-width: 0; 136 | } 137 | /* Today line */ 138 | .today { 139 | fill: none; 140 | stroke: #DB5757; 141 | stroke-width: 2px; 142 | } 143 | /* Task styling */ 144 | /* Default task */ 145 | .task { 146 | stroke-width: 1; 147 | } 148 | .taskText { 149 | text-anchor: middle; 150 | font-size: 11px; 151 | } 152 | .taskTextOutsideRight { 153 | fill: #323D47; 154 | text-anchor: start; 155 | font-size: 11px; 156 | } 157 | .taskTextOutsideLeft { 158 | fill: #323D47; 159 | text-anchor: end; 160 | font-size: 11px; 161 | } 162 | /* Specific task settings for the sections*/ 163 | .taskText0, 164 | .taskText1, 165 | .taskText2, 166 | .taskText3 { 167 | fill: #323D47; 168 | } 169 | .task0, 170 | .task1, 171 | .task2, 172 | .task3 { 173 | fill: #BDD5EA; 174 | stroke: rgba(255, 255, 255, 0.5); 175 | } 176 | .taskTextOutside0, 177 | .taskTextOutside2 { 178 | fill: lightgrey; 179 | } 180 | .taskTextOutside1, 181 | .taskTextOutside3 { 182 | fill: lightgrey; 183 | } 184 | /* Active task */ 185 | .active0, 186 | .active1, 187 | .active2, 188 | .active3 { 189 | fill: #81B1DB; 190 | stroke: rgba(255, 255, 255, 0.5); 191 | } 192 | .activeText0, 193 | .activeText1, 194 | .activeText2, 195 | .activeText3 { 196 | fill: #323D47 !important; 197 | } 198 | /* Completed task */ 199 | .done0, 200 | .done1, 201 | .done2, 202 | .done3 { 203 | fill: lightgrey; 204 | } 205 | .doneText0, 206 | .doneText1, 207 | .doneText2, 208 | .doneText3 { 209 | fill: #323D47 !important; 210 | } 211 | /* Tasks on the critical line */ 212 | .crit0, 213 | .crit1, 214 | .crit2, 215 | .crit3 { 216 | stroke: #E83737; 217 | fill: #E83737; 218 | stroke-width: 2; 219 | } 220 | .activeCrit0, 221 | .activeCrit1, 222 | .activeCrit2, 223 | .activeCrit3 { 224 | stroke: #E83737; 225 | fill: #81B1DB; 226 | stroke-width: 2; 227 | } 228 | .doneCrit0, 229 | .doneCrit1, 230 | .doneCrit2, 231 | .doneCrit3 { 232 | stroke: #E83737; 233 | fill: lightgrey; 234 | stroke-width: 1; 235 | cursor: pointer; 236 | shape-rendering: crispEdges; 237 | } 238 | .doneCritText0, 239 | .doneCritText1, 240 | .doneCritText2, 241 | .doneCritText3 { 242 | fill: lightgrey !important; 243 | } 244 | .activeCritText0, 245 | .activeCritText1, 246 | .activeCritText2, 247 | .activeCritText3 { 248 | fill: #323D47 !important; 249 | } 250 | .titleText { 251 | text-anchor: middle; 252 | font-size: 18px; 253 | fill: lightgrey; 254 | } 255 | /* 256 | */ 257 | .node text { 258 | font-family: 'trebuchet ms', verdana, arial; 259 | font-size: 14px; 260 | } 261 | div.mermaidTooltip { 262 | position: absolute; 263 | text-align: center; 264 | max-width: 200px; 265 | padding: 2px; 266 | font-family: 'trebuchet ms', verdana, arial; 267 | font-size: 12px; 268 | background: #6D6D65; 269 | border: 1px solid rgba(255, 255, 255, 0.25); 270 | border-radius: 2px; 271 | pointer-events: none; 272 | z-index: 100; 273 | } -------------------------------------------------------------------------------- /docs/css/photoswipe.default-skin.min.css: -------------------------------------------------------------------------------- 1 | /*! PhotoSwipe Default UI CSS by Dmitry Semenov | photoswipe.com | MIT license */.pswp__button{width:44px;height:44px;position:relative;background:0 0;cursor:pointer;overflow:visible;-webkit-appearance:none;display:block;border:0;padding:0;margin:0;float:right;opacity:.75;-webkit-transition:opacity .2s;transition:opacity .2s;-webkit-box-shadow:none;box-shadow:none}.pswp__button:focus,.pswp__button:hover{opacity:1}.pswp__button:active{outline:0;opacity:.9}.pswp__button::-moz-focus-inner{padding:0;border:0}.pswp__ui--over-close .pswp__button--close{opacity:1}.pswp__button,.pswp__button--arrow--left:before,.pswp__button--arrow--right:before{background:url(default-skin.png) 0 0 no-repeat;background-size:264px 88px;width:44px;height:44px}@media (-webkit-min-device-pixel-ratio:1.1),(-webkit-min-device-pixel-ratio:1.09375),(min-resolution:105dpi),(min-resolution:1.1dppx){.pswp--svg .pswp__button,.pswp--svg .pswp__button--arrow--left:before,.pswp--svg .pswp__button--arrow--right:before{background-image:url(default-skin.svg)}.pswp--svg .pswp__button--arrow--left,.pswp--svg .pswp__button--arrow--right{background:0 0}}.pswp__button--close{background-position:0 -44px}.pswp__button--share{background-position:-44px -44px}.pswp__button--fs{display:none}.pswp--supports-fs .pswp__button--fs{display:block}.pswp--fs .pswp__button--fs{background-position:-44px 0}.pswp__button--zoom{display:none;background-position:-88px 0}.pswp--zoom-allowed .pswp__button--zoom{display:block}.pswp--zoomed-in .pswp__button--zoom{background-position:-132px 0}.pswp--touch .pswp__button--arrow--left,.pswp--touch .pswp__button--arrow--right{visibility:hidden}.pswp__button--arrow--left,.pswp__button--arrow--right{background:0 0;top:50%;margin-top:-50px;width:70px;height:100px;position:absolute}.pswp__button--arrow--left{left:0}.pswp__button--arrow--right{right:0}.pswp__button--arrow--left:before,.pswp__button--arrow--right:before{content:'';top:35px;background-color:rgba(0,0,0,.3);height:30px;width:32px;position:absolute}.pswp__button--arrow--left:before{left:6px;background-position:-138px -44px}.pswp__button--arrow--right:before{right:6px;background-position:-94px -44px}.pswp__counter,.pswp__share-modal{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.pswp__share-modal{display:block;background:rgba(0,0,0,.5);width:100%;height:100%;top:0;left:0;padding:10px;position:absolute;z-index:1600;opacity:0;-webkit-transition:opacity .25s ease-out;transition:opacity .25s ease-out;-webkit-backface-visibility:hidden;will-change:opacity}.pswp__share-modal--hidden{display:none}.pswp__share-tooltip{z-index:1620;position:absolute;background:#fff;top:56px;border-radius:2px;display:block;width:auto;right:44px;-webkit-box-shadow:0 2px 5px rgba(0,0,0,.25);box-shadow:0 2px 5px rgba(0,0,0,.25);-webkit-transform:translateY(6px);-ms-transform:translateY(6px);transform:translateY(6px);-webkit-transition:-webkit-transform .25s;transition:transform .25s;-webkit-backface-visibility:hidden;will-change:transform}.pswp__share-tooltip a{display:block;padding:8px 12px;color:#000;text-decoration:none;font-size:14px;line-height:18px}.pswp__share-tooltip a:hover{text-decoration:none;color:#000}.pswp__share-tooltip a:first-child{border-radius:2px 2px 0 0}.pswp__share-tooltip a:last-child{border-radius:0 0 2px 2px}.pswp__share-modal--fade-in{opacity:1}.pswp__share-modal--fade-in .pswp__share-tooltip{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}.pswp--touch .pswp__share-tooltip a{padding:16px 12px}a.pswp__share--facebook:before{content:'';display:block;width:0;height:0;position:absolute;top:-12px;right:15px;border:6px solid transparent;border-bottom-color:#fff;-webkit-pointer-events:none;-moz-pointer-events:none;pointer-events:none}a.pswp__share--facebook:hover{background:#3e5c9a;color:#fff}a.pswp__share--facebook:hover:before{border-bottom-color:#3e5c9a}a.pswp__share--twitter:hover{background:#55acee;color:#fff}a.pswp__share--pinterest:hover{background:#ccc;color:#ce272d}a.pswp__share--download:hover{background:#ddd}.pswp__counter{position:absolute;left:0;top:0;height:44px;font-size:13px;line-height:44px;color:#fff;opacity:.75;padding:0 10px}.pswp__caption{position:absolute;left:0;bottom:0;width:100%;min-height:44px}.pswp__caption small{font-size:11px;color:#bbb}.pswp__caption__center{text-align:left;max-width:420px;margin:0 auto;font-size:13px;padding:10px;line-height:20px;color:#ccc}.pswp__caption--empty{display:none}.pswp__caption--fake{visibility:hidden}.pswp__preloader{width:44px;height:44px;position:absolute;top:0;left:50%;margin-left:-22px;opacity:0;-webkit-transition:opacity .25s ease-out;transition:opacity .25s ease-out;will-change:opacity;direction:ltr}.pswp__preloader__icn{width:20px;height:20px;margin:12px}.pswp__preloader--active{opacity:1}.pswp__preloader--active .pswp__preloader__icn{background:url(preloader.gif) 0 0 no-repeat}.pswp--css_animation .pswp__preloader--active{opacity:1}.pswp--css_animation .pswp__preloader--active .pswp__preloader__icn{-webkit-animation:clockwise .5s linear infinite;animation:clockwise .5s linear infinite}.pswp--css_animation .pswp__preloader--active .pswp__preloader__donut{-webkit-animation:donut-rotate 1s cubic-bezier(.4,0,.22,1) infinite;animation:donut-rotate 1s cubic-bezier(.4,0,.22,1) infinite}.pswp--css_animation .pswp__preloader__icn{background:0 0;opacity:.75;width:14px;height:14px;position:absolute;left:15px;top:15px;margin:0}.pswp--css_animation .pswp__preloader__cut{position:relative;width:7px;height:14px;overflow:hidden}.pswp--css_animation .pswp__preloader__donut{-webkit-box-sizing:border-box;box-sizing:border-box;width:14px;height:14px;border:2px solid #fff;border-radius:50%;border-left-color:transparent;border-bottom-color:transparent;position:absolute;top:0;left:0;background:0 0;margin:0}@media screen and (max-width:1024px){.pswp__preloader{position:relative;left:auto;top:auto;margin:0;float:right}}@-webkit-keyframes clockwise{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes clockwise{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes donut-rotate{0%{-webkit-transform:rotate(0);transform:rotate(0)}50%{-webkit-transform:rotate(-140deg);transform:rotate(-140deg)}100%{-webkit-transform:rotate(0);transform:rotate(0)}}@keyframes donut-rotate{0%{-webkit-transform:rotate(0);transform:rotate(0)}50%{-webkit-transform:rotate(-140deg);transform:rotate(-140deg)}100%{-webkit-transform:rotate(0);transform:rotate(0)}}.pswp__ui{-webkit-font-smoothing:auto;visibility:visible;opacity:1;z-index:1550}.pswp__top-bar{position:absolute;left:0;top:0;height:44px;width:100%}.pswp--has_mouse .pswp__button--arrow--left,.pswp--has_mouse .pswp__button--arrow--right,.pswp__caption,.pswp__top-bar{-webkit-backface-visibility:hidden;will-change:opacity;-webkit-transition:opacity 333ms cubic-bezier(.4,0,.22,1);transition:opacity 333ms cubic-bezier(.4,0,.22,1)}.pswp--has_mouse .pswp__button--arrow--left,.pswp--has_mouse .pswp__button--arrow--right{visibility:visible}.pswp__caption,.pswp__top-bar{background-color:rgba(0,0,0,.5)}.pswp__ui--fit .pswp__caption,.pswp__ui--fit .pswp__top-bar{background-color:rgba(0,0,0,.3)}.pswp__ui--idle .pswp__top-bar{opacity:0}.pswp__ui--idle .pswp__button--arrow--left,.pswp__ui--idle .pswp__button--arrow--right{opacity:0}.pswp__ui--hidden .pswp__button--arrow--left,.pswp__ui--hidden .pswp__button--arrow--right,.pswp__ui--hidden .pswp__caption,.pswp__ui--hidden .pswp__top-bar{opacity:.001}.pswp__ui--one-slide .pswp__button--arrow--left,.pswp__ui--one-slide .pswp__button--arrow--right,.pswp__ui--one-slide .pswp__counter{display:none}.pswp__element--disabled{display:none!important}.pswp--minimal--dark .pswp__top-bar{background:0 0}/*# sourceMappingURL=default-skin.min.css.map */ -------------------------------------------------------------------------------- /docs/css/photoswipe.min.css: -------------------------------------------------------------------------------- 1 | /*! PhotoSwipe main CSS by Dmitry Semenov | photoswipe.com | MIT license */.pswp{display:none;position:absolute;width:100%;height:100%;left:0;top:0;overflow:hidden;-ms-touch-action:none;touch-action:none;z-index:1500;-webkit-text-size-adjust:100%;-webkit-backface-visibility:hidden;outline:0}.pswp *{-webkit-box-sizing:border-box;box-sizing:border-box}.pswp img{max-width:none}.pswp--animate_opacity{opacity:.001;will-change:opacity;-webkit-transition:opacity 333ms cubic-bezier(.4,0,.22,1);transition:opacity 333ms cubic-bezier(.4,0,.22,1)}.pswp--open{display:block}.pswp--zoom-allowed .pswp__img{cursor:-webkit-zoom-in;cursor:-moz-zoom-in;cursor:zoom-in}.pswp--zoomed-in .pswp__img{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.pswp--dragging .pswp__img{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.pswp__bg{position:absolute;left:0;top:0;width:100%;height:100%;background:#000;opacity:0;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-backface-visibility:hidden;will-change:opacity}.pswp__scroll-wrap{position:absolute;left:0;top:0;width:100%;height:100%;overflow:hidden}.pswp__container,.pswp__zoom-wrap{-ms-touch-action:none;touch-action:none;position:absolute;left:0;right:0;top:0;bottom:0}.pswp__container,.pswp__img{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none}.pswp__zoom-wrap{position:absolute;width:100%;-webkit-transform-origin:left top;-ms-transform-origin:left top;transform-origin:left top;-webkit-transition:-webkit-transform 333ms cubic-bezier(.4,0,.22,1);transition:transform 333ms cubic-bezier(.4,0,.22,1)}.pswp__bg{will-change:opacity;-webkit-transition:opacity 333ms cubic-bezier(.4,0,.22,1);transition:opacity 333ms cubic-bezier(.4,0,.22,1)}.pswp--animated-in .pswp__bg,.pswp--animated-in .pswp__zoom-wrap{-webkit-transition:none;transition:none}.pswp__container,.pswp__zoom-wrap{-webkit-backface-visibility:hidden}.pswp__item{position:absolute;left:0;right:0;top:0;bottom:0;overflow:hidden}.pswp__img{position:absolute;width:auto;height:auto;top:0;left:0}.pswp__img--placeholder{-webkit-backface-visibility:hidden}.pswp__img--placeholder--blank{background:#222}.pswp--ie .pswp__img{width:100%!important;height:auto!important;left:0;top:0}.pswp__error-msg{position:absolute;left:0;top:50%;width:100%;text-align:center;font-size:14px;line-height:16px;margin-top:-8px;color:#ccc}.pswp__error-msg a{color:#ccc;text-decoration:underline}/*# sourceMappingURL=photoswipe.min.css.map */ -------------------------------------------------------------------------------- /docs/css/staticman.css: -------------------------------------------------------------------------------- 1 | .staticman-comments { 2 | padding: 20px 0px 0px 0px; 3 | } 4 | 5 | .staticman-comments .comment-content{ 6 | border-top: 1px solid #EEEEEE; 7 | padding: 4px 0px 30px 0px; 8 | } 9 | 10 | .staticman-comments .comment-content p { 11 | padding: 5px 0px 5px 0px; 12 | margin: 5px 58px 0px 58px; 13 | } 14 | 15 | .staticman-comments .textfield { 16 | width: 420px; 17 | max-width: 100%; 18 | padding: 0.5rem 0; 19 | width: 100%; 20 | } 21 | 22 | .staticman-comments input { 23 | border: 1px solid rgba(0,0,0,0.12); 24 | padding: 4px 5px; 25 | width: 100%; 26 | } 27 | 28 | 29 | .staticman-comments .g-recaptcha { 30 | padding: 0.5rem 0; 31 | } 32 | 33 | .staticman-comments textarea { 34 | border: 1px solid rgba(0,0,0,0.12); 35 | padding: 4px 5px; 36 | vertical-align: top; 37 | height: 10em; 38 | width: 100%; 39 | } 40 | 41 | .staticman-comments .comment-avatar { 42 | float:left; 43 | width: 48; 44 | height: 48; 45 | margin-right: 10px; 46 | } 47 | 48 | .staticman-comments .show-modal { 49 | overflow: hidden; 50 | position: relative; 51 | } 52 | 53 | .staticman-comments .show-modal:before { 54 | position: absolute; 55 | content: ''; 56 | top: 0; 57 | left: 0; 58 | width: 100%; 59 | height: 100%; 60 | z-index: 999; 61 | background-color: rgba(0, 0, 0, 0.85); 62 | } 63 | 64 | .show-modal .modal { 65 | display: block; 66 | } 67 | 68 | .modal { 69 | display: none; 70 | position: fixed; 71 | width: 300px; 72 | top: 50%; 73 | left: 50%; 74 | margin-left: -150px; 75 | margin-top: -150px; 76 | min-height: 0; 77 | height: 30%; 78 | z-index: 9999; 79 | padding: 0.5rem; 80 | border: 1px solid rgba(0,0,0,0.25); 81 | background-color: rgba(220,220,220,0.9); 82 | height: 10em; 83 | } 84 | 85 | .form--loading:before { 86 | content: ''; 87 | } 88 | 89 | .form--loading .form__spinner { 90 | display: block; 91 | } 92 | -------------------------------------------------------------------------------- /docs/css/syntax.css: -------------------------------------------------------------------------------- 1 | /* Background */ .chroma { background-color: #ffffff } 2 | /* Error */ .chroma .err { color: #a61717; background-color: #e3d2d2 } 3 | /* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; } 4 | /* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; width: auto; overflow: auto; display: block; } 5 | /* LineHighlight */ .chroma .hl { display: block; width: 100%;background-color: #ffffcc } 6 | /* LineNumbersTable */ .chroma .lnt { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f } 7 | /* LineNumbers */ .chroma .ln { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f } 8 | /* Keyword */ .chroma .k { font-weight: bold } 9 | /* KeywordConstant */ .chroma .kc { font-weight: bold } 10 | /* KeywordDeclaration */ .chroma .kd { font-weight: bold } 11 | /* KeywordNamespace */ .chroma .kn { font-weight: bold } 12 | /* KeywordPseudo */ .chroma .kp { font-weight: bold } 13 | /* KeywordReserved */ .chroma .kr { font-weight: bold } 14 | /* KeywordType */ .chroma .kt { color: #445588; font-weight: bold } 15 | /* NameAttribute */ .chroma .na { color: #008080 } 16 | /* NameBuiltin */ .chroma .nb { color: #999999 } 17 | /* NameClass */ .chroma .nc { color: #445588; font-weight: bold } 18 | /* NameConstant */ .chroma .no { color: #008080 } 19 | /* NameEntity */ .chroma .ni { color: #800080 } 20 | /* NameException */ .chroma .ne { color: #990000; font-weight: bold } 21 | /* NameFunction */ .chroma .nf { color: #990000; font-weight: bold } 22 | /* NameNamespace */ .chroma .nn { color: #555555 } 23 | /* NameTag */ .chroma .nt { color: #000080 } 24 | /* NameVariable */ .chroma .nv { color: #008080 } 25 | /* LiteralString */ .chroma .s { color: #bb8844 } 26 | /* LiteralStringAffix */ .chroma .sa { color: #bb8844 } 27 | /* LiteralStringBacktick */ .chroma .sb { color: #bb8844 } 28 | /* LiteralStringChar */ .chroma .sc { color: #bb8844 } 29 | /* LiteralStringDelimiter */ .chroma .dl { color: #bb8844 } 30 | /* LiteralStringDoc */ .chroma .sd { color: #bb8844 } 31 | /* LiteralStringDouble */ .chroma .s2 { color: #bb8844 } 32 | /* LiteralStringEscape */ .chroma .se { color: #bb8844 } 33 | /* LiteralStringHeredoc */ .chroma .sh { color: #bb8844 } 34 | /* LiteralStringInterpol */ .chroma .si { color: #bb8844 } 35 | /* LiteralStringOther */ .chroma .sx { color: #bb8844 } 36 | /* LiteralStringRegex */ .chroma .sr { color: #808000 } 37 | /* LiteralStringSingle */ .chroma .s1 { color: #bb8844 } 38 | /* LiteralStringSymbol */ .chroma .ss { color: #bb8844 } 39 | /* LiteralNumber */ .chroma .m { color: #009999 } 40 | /* LiteralNumberBin */ .chroma .mb { color: #009999 } 41 | /* LiteralNumberFloat */ .chroma .mf { color: #009999 } 42 | /* LiteralNumberHex */ .chroma .mh { color: #009999 } 43 | /* LiteralNumberInteger */ .chroma .mi { color: #009999 } 44 | /* LiteralNumberIntegerLong */ .chroma .il { color: #009999 } 45 | /* LiteralNumberOct */ .chroma .mo { color: #009999 } 46 | /* Operator */ .chroma .o { font-weight: bold } 47 | /* OperatorWord */ .chroma .ow { font-weight: bold } 48 | /* Comment */ .chroma .c { color: #999988; font-style: italic } 49 | /* CommentHashbang */ .chroma .ch { color: #999988; font-style: italic } 50 | /* CommentMultiline */ .chroma .cm { color: #999988; font-style: italic } 51 | /* CommentSingle */ .chroma .c1 { color: #999988; font-style: italic } 52 | /* CommentSpecial */ .chroma .cs { color: #999999; font-weight: bold; font-style: italic } 53 | /* CommentPreproc */ .chroma .cp { color: #999999; font-weight: bold } 54 | /* CommentPreprocFile */ .chroma .cpf { color: #999999; font-weight: bold } 55 | /* GenericDeleted */ .chroma .gd { color: #000000; background-color: #ffdddd } 56 | /* GenericEmph */ .chroma .ge { font-style: italic } 57 | /* GenericError */ .chroma .gr { color: #aa0000 } 58 | /* GenericHeading */ .chroma .gh { color: #999999 } 59 | /* GenericInserted */ .chroma .gi { color: #000000; background-color: #ddffdd } 60 | /* GenericOutput */ .chroma .go { color: #888888 } 61 | /* GenericPrompt */ .chroma .gp { color: #555555 } 62 | /* GenericStrong */ .chroma .gs { font-weight: bold } 63 | /* GenericSubheading */ .chroma .gu { color: #aaaaaa } 64 | /* GenericTraceback */ .chroma .gt { color: #aa0000 } 65 | /* GenericUnderline */ .chroma .gl { text-decoration: underline } 66 | /* TextWhitespace */ .chroma .w { color: #bbbbbb } 67 | -------------------------------------------------------------------------------- /docs/fontawesome/webfonts/fa-brands-400.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fontawesome/webfonts/fa-brands-400.eot -------------------------------------------------------------------------------- /docs/fontawesome/webfonts/fa-brands-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fontawesome/webfonts/fa-brands-400.ttf -------------------------------------------------------------------------------- /docs/fontawesome/webfonts/fa-brands-400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fontawesome/webfonts/fa-brands-400.woff -------------------------------------------------------------------------------- /docs/fontawesome/webfonts/fa-brands-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fontawesome/webfonts/fa-brands-400.woff2 -------------------------------------------------------------------------------- /docs/fontawesome/webfonts/fa-regular-400.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fontawesome/webfonts/fa-regular-400.eot -------------------------------------------------------------------------------- /docs/fontawesome/webfonts/fa-regular-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fontawesome/webfonts/fa-regular-400.ttf -------------------------------------------------------------------------------- /docs/fontawesome/webfonts/fa-regular-400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fontawesome/webfonts/fa-regular-400.woff -------------------------------------------------------------------------------- /docs/fontawesome/webfonts/fa-regular-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fontawesome/webfonts/fa-regular-400.woff2 -------------------------------------------------------------------------------- /docs/fontawesome/webfonts/fa-solid-900.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fontawesome/webfonts/fa-solid-900.eot -------------------------------------------------------------------------------- /docs/fontawesome/webfonts/fa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fontawesome/webfonts/fa-solid-900.ttf -------------------------------------------------------------------------------- /docs/fontawesome/webfonts/fa-solid-900.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fontawesome/webfonts/fa-solid-900.woff -------------------------------------------------------------------------------- /docs/fontawesome/webfonts/fa-solid-900.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fontawesome/webfonts/fa-solid-900.woff2 -------------------------------------------------------------------------------- /docs/fonts/lora/lora-v12-latin-700.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/lora/lora-v12-latin-700.eot -------------------------------------------------------------------------------- /docs/fonts/lora/lora-v12-latin-700.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/lora/lora-v12-latin-700.ttf -------------------------------------------------------------------------------- /docs/fonts/lora/lora-v12-latin-700.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/lora/lora-v12-latin-700.woff -------------------------------------------------------------------------------- /docs/fonts/lora/lora-v12-latin-700.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/lora/lora-v12-latin-700.woff2 -------------------------------------------------------------------------------- /docs/fonts/lora/lora-v12-latin-700italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/lora/lora-v12-latin-700italic.eot -------------------------------------------------------------------------------- /docs/fonts/lora/lora-v12-latin-700italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/lora/lora-v12-latin-700italic.ttf -------------------------------------------------------------------------------- /docs/fonts/lora/lora-v12-latin-700italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/lora/lora-v12-latin-700italic.woff -------------------------------------------------------------------------------- /docs/fonts/lora/lora-v12-latin-700italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/lora/lora-v12-latin-700italic.woff2 -------------------------------------------------------------------------------- /docs/fonts/lora/lora-v12-latin-italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/lora/lora-v12-latin-italic.eot -------------------------------------------------------------------------------- /docs/fonts/lora/lora-v12-latin-italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/lora/lora-v12-latin-italic.ttf -------------------------------------------------------------------------------- /docs/fonts/lora/lora-v12-latin-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/lora/lora-v12-latin-italic.woff -------------------------------------------------------------------------------- /docs/fonts/lora/lora-v12-latin-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/lora/lora-v12-latin-italic.woff2 -------------------------------------------------------------------------------- /docs/fonts/lora/lora-v12-latin-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/lora/lora-v12-latin-regular.eot -------------------------------------------------------------------------------- /docs/fonts/lora/lora-v12-latin-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/lora/lora-v12-latin-regular.ttf -------------------------------------------------------------------------------- /docs/fonts/lora/lora-v12-latin-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/lora/lora-v12-latin-regular.woff -------------------------------------------------------------------------------- /docs/fonts/lora/lora-v12-latin-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/lora/lora-v12-latin-regular.woff2 -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-300.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-300.eot -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-300.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-300.ttf -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-300.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-300.woff -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-300.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-300.woff2 -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-300italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-300italic.eot -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-300italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-300italic.ttf -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-300italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-300italic.woff -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-300italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-300italic.woff2 -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-600.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-600.eot -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-600.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-600.ttf -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-600.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-600.woff -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-600.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-600.woff2 -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-600italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-600italic.eot -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-600italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-600italic.ttf -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-600italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-600italic.woff -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-600italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-600italic.woff2 -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-700.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-700.eot -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-700.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-700.ttf -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-700.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-700.woff -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-700.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-700.woff2 -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-700italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-700italic.eot -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-700italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-700italic.ttf -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-700italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-700italic.woff -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-700italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-700italic.woff2 -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-800.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-800.eot -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-800.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-800.ttf -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-800.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-800.woff -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-800.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-800.woff2 -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-800italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-800italic.eot -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-800italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-800italic.ttf -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-800italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-800italic.woff -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-800italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-800italic.woff2 -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-italic.eot -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-italic.svg: -------------------------------------------------------------------------------- 1 | Error 500 (Server Error)!!1

500. That’s an error.

There was an error. Please try again later. That’s all we know.

-------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-italic.ttf -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-italic.woff -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-italic.woff2 -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-regular.eot -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-regular.ttf -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-regular.woff -------------------------------------------------------------------------------- /docs/fonts/open-sans/open-sans-v15-latin-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/fonts/open-sans/open-sans-v15-latin-regular.woff2 -------------------------------------------------------------------------------- /docs/images/DFA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/images/DFA.png -------------------------------------------------------------------------------- /docs/images/ParserClassification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/images/ParserClassification.png -------------------------------------------------------------------------------- /docs/images/WebApiDsl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/images/WebApiDsl.png -------------------------------------------------------------------------------- /docs/images/exampleParseTree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/images/exampleParseTree.png -------------------------------------------------------------------------------- /docs/images/memory1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/images/memory1.png -------------------------------------------------------------------------------- /docs/images/memory2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/images/memory2.png -------------------------------------------------------------------------------- /docs/images/memory3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/images/memory3.png -------------------------------------------------------------------------------- /docs/images/numDevelopers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/images/numDevelopers.png -------------------------------------------------------------------------------- /docs/images/parseTree2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/images/parseTree2.png -------------------------------------------------------------------------------- /docs/images/parseTree3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/images/parseTree3.png -------------------------------------------------------------------------------- /docs/images/stepsBuildCompiler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/images/stepsBuildCompiler.png -------------------------------------------------------------------------------- /docs/images/timeToLearn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/images/timeToLearn.png -------------------------------------------------------------------------------- /docs/img/avatar-favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/img/avatar-favicon.png -------------------------------------------------------------------------------- /docs/img/avatar-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/img/avatar-icon.png -------------------------------------------------------------------------------- /docs/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/img/favicon.ico -------------------------------------------------------------------------------- /docs/img/favicon.ico.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/img/favicon.ico.zip -------------------------------------------------------------------------------- /docs/img/hexagon-thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/img/hexagon-thumb.jpg -------------------------------------------------------------------------------- /docs/img/hexagon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/img/hexagon.jpg -------------------------------------------------------------------------------- /docs/img/path.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/img/path.jpg -------------------------------------------------------------------------------- /docs/img/sphere-thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/img/sphere-thumb.jpg -------------------------------------------------------------------------------- /docs/img/sphere.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/img/sphere.jpg -------------------------------------------------------------------------------- /docs/img/triangle-thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/img/triangle-thumb.jpg -------------------------------------------------------------------------------- /docs/img/triangle.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pgrandinetti/compilers/4f792e437ab1e4e017a2be384805c82e169e59c3/docs/img/triangle.jpg -------------------------------------------------------------------------------- /docs/js/auto-render.min.js: -------------------------------------------------------------------------------- 1 | (function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.renderMathInElement=e()}})(function(){var e,t,r;return function n(e,t,r){function a(o,l){if(!t[o]){if(!e[o]){var f=typeof require=="function"&&require;if(!l&&f)return f(o,!0);if(i)return i(o,!0);var d=new Error("Cannot find module '"+o+"'");throw d.code="MODULE_NOT_FOUND",d}var s=t[o]={exports:{}};e[o][0].call(s.exports,function(t){var r=e[o][1][t];return a(r?r:t)},s,s.exports,n,e,t,r)}return t[o].exports}var i=typeof require=="function"&&require;for(var o=0;o tag is set, read it and create an item 23 | if ($a.data('size')) { 24 | var $size = $a.data('size').split('x'); 25 | var item = { 26 | src : $src, 27 | w : $size[0], 28 | h : $size[1], 29 | title : $title, 30 | msrc : $msrc 31 | }; 32 | //console.log("Using pre-defined dimensions for " + $src); 33 | // if not, set temp default size then load the image to check actual size 34 | } else { 35 | var item = { 36 | src : $src, 37 | w : 800, // temp default size 38 | h : 600, // temp default size 39 | title : $title, 40 | msrc : $msrc 41 | }; 42 | //console.log("Using default dimensions for " + $src); 43 | // load the image to check its dimensions 44 | // update the item as soon as w and h are known (check every 30ms) 45 | var img = new Image(); 46 | img.src = $src; 47 | var wait = setInterval(function() { 48 | var w = img.naturalWidth, 49 | h = img.naturalHeight; 50 | if (w && h) { 51 | clearInterval(wait); 52 | item.w = w; 53 | item.h = h; 54 | //console.log("Got actual dimensions for " + img.src); 55 | } 56 | }, 30); 57 | } 58 | // Save the index of this image then add it to the array 59 | var index = items.length; 60 | items.push(item); 61 | // Event handler for click on a figure 62 | $figure.on('click', function(event) { 63 | event.preventDefault(); // prevent the normal behaviour i.e. load the hyperlink 64 | // Get the PSWP element and initialise it with the desired options 65 | var $pswp = $('.pswp')[0]; 66 | var options = { 67 | index: index, 68 | bgOpacity: 0.8, 69 | showHideOpacity: true 70 | } 71 | new PhotoSwipe($pswp, PhotoSwipeUI_Default, items, options).init(); 72 | }); 73 | }); 74 | }); -------------------------------------------------------------------------------- /docs/js/main.js: -------------------------------------------------------------------------------- 1 | // Dean Attali / Beautiful Jekyll 2016 2 | 3 | var main = { 4 | 5 | bigImgEl : null, 6 | numImgs : null, 7 | 8 | init : function() { 9 | // Shorten the navbar after scrolling a little bit down 10 | $(window).scroll(function() { 11 | if ($(".navbar").offset().top > 50) { 12 | $(".navbar").addClass("top-nav-short"); 13 | } else { 14 | $(".navbar").removeClass("top-nav-short"); 15 | } 16 | }); 17 | 18 | // On mobile, hide the avatar when expanding the navbar menu 19 | $('#main-navbar').on('show.bs.collapse', function () { 20 | $(".navbar").addClass("top-nav-expanded"); 21 | }); 22 | $('#main-navbar').on('hidden.bs.collapse', function () { 23 | $(".navbar").removeClass("top-nav-expanded"); 24 | }); 25 | 26 | // On mobile, when clicking on a multi-level navbar menu, show the child links 27 | $('#main-navbar').on("click", ".navlinks-parent", function(e) { 28 | var target = e.target; 29 | $.each($(".navlinks-parent"), function(key, value) { 30 | if (value == target) { 31 | $(value).parent().toggleClass("show-children"); 32 | } else { 33 | $(value).parent().removeClass("show-children"); 34 | } 35 | }); 36 | }); 37 | 38 | // Ensure nested navbar menus are not longer than the menu header 39 | var menus = $(".navlinks-container"); 40 | if (menus.length > 0) { 41 | var navbar = $("#main-navbar").find("ul"); 42 | var fakeMenuHtml = ""; 43 | navbar.append(fakeMenuHtml); 44 | var fakeMenu = $(".fake-menu"); 45 | 46 | $.each(menus, function(i) { 47 | var parent = $(menus[i]).find(".navlinks-parent"); 48 | var children = $(menus[i]).find(".navlinks-children a"); 49 | var words = []; 50 | $.each(children, function(idx, el) { words = words.concat($(el).text().trim().split(/\s+/)); }); 51 | var maxwidth = 0; 52 | $.each(words, function(id, word) { 53 | fakeMenu.html("" + word + ""); 54 | var width = fakeMenu.width(); 55 | if (width > maxwidth) { 56 | maxwidth = width; 57 | } 58 | }); 59 | $(menus[i]).css('min-width', maxwidth + 'px') 60 | }); 61 | 62 | fakeMenu.remove(); 63 | } 64 | 65 | // show the big header image 66 | main.initImgs(); 67 | }, 68 | 69 | initImgs : function() { 70 | // If the page was large images to randomly select from, choose an image 71 | if ($("#header-big-imgs").length > 0) { 72 | main.bigImgEl = $("#header-big-imgs"); 73 | main.numImgs = main.bigImgEl.attr("data-num-img"); 74 | 75 | // 2fc73a3a967e97599c9763d05e564189 76 | // set an initial image 77 | var imgInfo = main.getImgInfo(); 78 | var src = imgInfo.src; 79 | var desc = imgInfo.desc; 80 | var position = imgInfo.position; 81 | main.setImg(src, desc, position); 82 | 83 | // For better UX, prefetch the next image so that it will already be loaded when we want to show it 84 | var getNextImg = function() { 85 | var imgInfo = main.getImgInfo(); 86 | var src = imgInfo.src; 87 | var desc = imgInfo.desc; 88 | var position = imgInfo.position; 89 | 90 | var prefetchImg = new Image(); 91 | prefetchImg.src = src; 92 | // if I want to do something once the image is ready: `prefetchImg.onload = function(){}` 93 | 94 | setTimeout(function(){ 95 | var img = $("
").addClass("big-img-transition").css("background-image", 'url(' + src + ')'); 96 | if (position !== undefined) { 97 | img.css("background-position", position); 98 | } 99 | $(".intro-header.big-img").prepend(img); 100 | setTimeout(function(){ img.css("opacity", "1"); }, 50); 101 | 102 | // after the animation of fading in the new image is done, prefetch the next one 103 | //img.one("transitioned webkitTransitionEnd oTransitionEnd MSTransitionEnd", function(){ 104 | setTimeout(function() { 105 | main.setImg(src, desc, position); 106 | img.remove(); 107 | getNextImg(); 108 | }, 1000); 109 | //}); 110 | }, 6000); 111 | }; 112 | 113 | // If there are multiple images, cycle through them 114 | if (main.numImgs > 1) { 115 | getNextImg(); 116 | } 117 | } 118 | }, 119 | 120 | getImgInfo : function() { 121 | var randNum = Math.floor((Math.random() * main.numImgs) + 1); 122 | var src = main.bigImgEl.attr("data-img-src-" + randNum); 123 | var desc = main.bigImgEl.attr("data-img-desc-" + randNum); 124 | var position = main.bigImgEl.attr("data-img-position-" + randNum); 125 | 126 | return { 127 | src : src, 128 | desc : desc, 129 | position : position 130 | } 131 | }, 132 | 133 | setImg : function(src, desc, position) { 134 | $(".intro-header.big-img").css("background-image", 'url(' + src + ')'); 135 | if (position !== undefined) { 136 | $(".intro-header.big-img").css("background-position", position); 137 | } 138 | else { 139 | // Remove background-position if added to the prev image. 140 | $(".intro-header.big-img").css("background-position", ""); 141 | } 142 | if (typeof desc !== typeof undefined && desc !== false) { 143 | // Check for Markdown link 144 | var mdLinkRe = /\[(.*?)\]\((.+?)\)/; 145 | if (desc.match(mdLinkRe)) { 146 | // Split desc into parts, extracting md links 147 | var splitDesc = desc.split(mdLinkRe); 148 | 149 | // Build new description 150 | var imageDesc = $(".img-desc"); 151 | splitDesc.forEach(function (element, index){ 152 | // Check element type. If links every 2nd element is link text, and every 3rd link url 153 | if (index % 3 === 0) { 154 | // Regular text, just append it 155 | imageDesc.append(element); 156 | } 157 | if (index % 3 === 1) { 158 | // Link text - do nothing at the moment 159 | } 160 | if (index % 3 === 2) { 161 | // Link url - Create anchor tag with text 162 | var link = $("", { 163 | "href": element, 164 | "target": "_blank", 165 | "rel": "noopener noreferrer" 166 | }).text(splitDesc[index - 1]); 167 | imageDesc.append(link); 168 | } 169 | }); 170 | imageDesc.show(); 171 | } else { 172 | $(".img-desc").text(desc).show(); 173 | } 174 | } else { 175 | $(".img-desc").hide(); 176 | } 177 | } 178 | }; 179 | 180 | // 2fc73a3a967e97599c9763d05e564189 181 | 182 | document.addEventListener('DOMContentLoaded', main.init); -------------------------------------------------------------------------------- /docs/js/recaptcha.js: -------------------------------------------------------------------------------- 1 | /* PLEASE DO NOT COPY AND PASTE THIS CODE. */(function() {if (!window['___grecaptcha_cfg']) { window['___grecaptcha_cfg'] = {}; };if (!window['___grecaptcha_cfg']['render']) { window['___grecaptcha_cfg']['render'] = 'onload'; };window['__google_recaptcha_client'] = true;var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;po.src = 'https://www.gstatic.com/recaptcha/api2/r20171115120512/recaptcha__en.js'; var elem = document.querySelector('script[nonce]');var nonce = elem && (elem['nonce'] || elem.getAttribute('nonce'));if (nonce) { po.setAttribute('nonce', nonce); }var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);})(); -------------------------------------------------------------------------------- /docs/js/staticman.js: -------------------------------------------------------------------------------- 1 | // Static comments 2 | // from: https://github.com/eduardoboucas/popcorn/blob/gh-pages/js/main.js 3 | (function ($) { 4 | var $comments = $('.js-comments'); 5 | 6 | $('.js-form').submit(function () { 7 | var form = this; 8 | 9 | $(form).addClass('form--loading'); 10 | 11 | $.ajax({ 12 | type: $(this).attr('method'), 13 | url: $(this).attr('action'), 14 | data: $(this).serialize(), 15 | contentType: 'application/x-www-form-urlencoded', 16 | success: function (data) { 17 | showModal('Perfect !', 'Thanks for your comment! It will show on the site once it has been approved. .'); 18 | $(form).removeClass('form--loading'); 19 | }, 20 | error: function (err) { 21 | console.log(err); 22 | showModal('Error', 'Sorry, there was an error with the submission!'); 23 | $(form).removeClass('form--loading'); 24 | } 25 | }); 26 | 27 | return false; 28 | }); 29 | 30 | $('.js-close-modal').click(function () { 31 | $('body').removeClass('show-modal'); 32 | }); 33 | 34 | function showModal(title, message) { 35 | $('.js-modal-title').text(title); 36 | $('.js-modal-text').html(message); 37 | 38 | $('body').addClass('show-modal'); 39 | } 40 | })(jQuery); 41 | -------------------------------------------------------------------------------- /docs/page/1/index.html: -------------------------------------------------------------------------------- 1 | https://pgrandinetti.github.io/compilers/ -------------------------------------------------------------------------------- /docs/page/page/1/index.html: -------------------------------------------------------------------------------- 1 | https://pgrandinetti.github.io/compilers/page/ -------------------------------------------------------------------------------- /docs/sitemap.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | https://pgrandinetti.github.io/compilers/ 7 | 2019-12-29T00:00:00+00:00 8 | 9 | 10 | 11 | https://pgrandinetti.github.io/compilers/page/code-generation-for-a-new-programming-language/ 12 | 2019-10-14T00:00:00+00:00 13 | 14 | 15 | 16 | https://pgrandinetti.github.io/compilers/page/ 17 | 2019-10-14T00:00:00+00:00 18 | 19 | 20 | 21 | https://pgrandinetti.github.io/compilers/page/design-a-new-formal-grammar/ 22 | 2019-10-13T00:00:00+00:00 23 | 24 | 25 | 26 | https://pgrandinetti.github.io/compilers/page/do-compilers-depend-on-the-architecture/ 27 | 2019-10-13T00:00:00+00:00 28 | 29 | 30 | 31 | https://pgrandinetti.github.io/compilers/page/how-compilers-optimize-code-1/ 32 | 2019-10-13T00:00:00+00:00 33 | 34 | 35 | 36 | https://pgrandinetti.github.io/compilers/page/how-compilers-optimize-code-2/ 37 | 2019-10-13T00:00:00+00:00 38 | 39 | 40 | 41 | https://pgrandinetti.github.io/compilers/page/implementation-recursive-descent-parser/ 42 | 2019-10-13T00:00:00+00:00 43 | 44 | 45 | 46 | https://pgrandinetti.github.io/compilers/page/implementation-semantic-analysis/ 47 | 2019-10-13T00:00:00+00:00 48 | 49 | 50 | 51 | https://pgrandinetti.github.io/compilers/page/how-compilers-manage-garbage-collection/ 52 | 2019-10-12T00:00:00+00:00 53 | 54 | 55 | 56 | https://pgrandinetti.github.io/compilers/page/source-code-optimization-in-compilers/ 57 | 2019-10-12T00:00:00+00:00 58 | 59 | 60 | 61 | https://pgrandinetti.github.io/compilers/page/why-some-programming-language-is-faster/ 62 | 2019-10-12T00:00:00+00:00 63 | 64 | 65 | 66 | https://pgrandinetti.github.io/compilers/page/how-to-design-a-parser/ 67 | 2019-10-11T00:00:00+00:00 68 | 69 | 70 | 71 | https://pgrandinetti.github.io/compilers/page/how-to-design-semantic-analysis/ 72 | 2019-10-11T00:00:00+00:00 73 | 74 | 75 | 76 | https://pgrandinetti.github.io/compilers/page/where-compilers-use-finite-automata/ 77 | 2019-10-11T00:00:00+00:00 78 | 79 | 80 | 81 | https://pgrandinetti.github.io/compilers/page/where-compilers-use-regular-expressions/ 82 | 2019-10-11T00:00:00+00:00 83 | 84 | 85 | 86 | https://pgrandinetti.github.io/compilers/page/how-to-design-grammars/ 87 | 2019-10-10T00:00:00+00:00 88 | 89 | 90 | 91 | https://pgrandinetti.github.io/compilers/page/how-computer-runs-code/ 92 | 2019-10-08T00:00:00+00:00 93 | 94 | 95 | 96 | https://pgrandinetti.github.io/compilers/page/how-to-generate-runnable-code/ 97 | 2019-10-08T00:00:00+00:00 98 | 99 | 100 | 101 | https://pgrandinetti.github.io/compilers/page/introduction/ 102 | 2019-10-06T00:00:00+00:00 103 | 104 | 105 | 106 | https://pgrandinetti.github.io/compilers/page/what-is-semantic-analysis-in-compilers/ 107 | 2019-10-03T14:41:56+02:00 108 | 109 | 110 | 111 | https://pgrandinetti.github.io/compilers/page/what-is-a-programming-language-parser/ 112 | 2019-10-02T00:00:00+00:00 113 | 114 | 115 | 116 | https://pgrandinetti.github.io/compilers/page/how-to-build-a-new-programming-language/ 117 | 2019-10-01T00:00:00+00:00 118 | 119 | 120 | 121 | https://pgrandinetti.github.io/compilers/page/what-is-a-programming-language-grammar/ 122 | 2019-09-30T00:00:00+00:00 123 | 124 | 125 | 126 | https://pgrandinetti.github.io/compilers/page/what-are-the-differences-in-programming-languages/ 127 | 2019-09-29T00:00:00+00:00 128 | 129 | 130 | 131 | https://pgrandinetti.github.io/compilers/page/why-so-many-programming-languages/ 132 | 2019-09-28T00:00:00+00:00 133 | 134 | 135 | 136 | https://pgrandinetti.github.io/compilers/page/can-i-get-a-job-in-compilers/ 137 | 2019-09-27T00:00:00+00:00 138 | 139 | 140 | 141 | https://pgrandinetti.github.io/compilers/categories/ 142 | 143 | 144 | 145 | https://pgrandinetti.github.io/compilers/tags/ 146 | 147 | 148 | -------------------------------------------------------------------------------- /docs/tags/index.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tags on Compilers 5 | https://pgrandinetti.github.io/compilers/tags/ 6 | Recent content in Tags on Compilers 7 | Hugo -- gohugo.io 8 | en-us 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /grammar: -------------------------------------------------------------------------------- 1 | digit0 : 0-9 2 | 3 | digit : 1-9 4 | 5 | letter : a-z | A-Z 6 | 7 | otherChar : -ascii- 8 | 9 | char : letter | otherChar 10 | 11 | num : ('+' | '-')? float 12 | 13 | float : (frac exp?) | (int frac? exp?) 14 | 15 | int : '0' | digit+ digit0* 16 | 17 | frac : '.' int 18 | 19 | exp : '^' ('+' | '-')? int 20 | 21 | str : quotedStr ('+' quotedStr)* 22 | 23 | quotedStr : '"' (char)* '"' (',' obj)* 24 | 25 | bool : 'True' | 'False' 26 | 27 | null : 'NULL' 28 | 29 | var : letter (digit | letter)* 30 | 31 | list : '[' (listExpr)? ']' 32 | 33 | listElem : var '[' (int | var) ']' 34 | 35 | obj : var | num | str | bool | null | list | listElem 36 | 37 | listExpr : obj (',' obj)* 38 | 39 | #-------- ================ --------# 40 | 41 | program : (line ENDLINE)* 42 | 43 | ENDLINE : ';' '\n' 44 | 45 | line : assign 46 | | input 47 | | output 48 | | ifLine 49 | | loopLine 50 | | breakLine 51 | | contLine 52 | 53 | input : readIn var 54 | 55 | output : writeOut obj 56 | 57 | assign : var '=' expr 58 | 59 | expr : pred (condOp expr)? 60 | 61 | pred : term ( ('+' | '-') pred)? 62 | 63 | term : baseExpr ( ('*' | '/' | '/.' | '%') term)? 64 | 65 | baseExpr : obj 66 | | '(' expr ')' 67 | 68 | operator : '+' | '-' | '*' | '/' | '/.' | '%' | condOp 69 | 70 | condOp : '&&' | '||' | '!=' | '==' | '<=' | '>=' | '>' | '<' 71 | 72 | ifLine : if ifCond ifBody 73 | 74 | ifCond : '(' expr ')' 75 | 76 | ifBody : (line ENDLINE)+ (optElse)? 77 | 78 | optElse : else (line ENDLINE)+ 79 | 80 | loopLine : while ifCond loopBody 81 | 82 | loopBody : program 83 | 84 | #-------- ================ --------# 85 | 86 | readIn : 'readInt' | 'readFloat' | 'readBool' | 'readStr' 87 | 88 | writeOut : 'writeOut' 89 | 90 | breakLine : 'break' 91 | 92 | contLine : 'continue' 93 | 94 | if : 'if' 95 | 96 | while : 'while' 97 | 98 | else : 'else' 99 | -------------------------------------------------------------------------------- /lexer.h: -------------------------------------------------------------------------------- 1 | enum TokenType { 2 | // Basic Token Types in the Grammar 3 | Comma, 4 | Lpar, // ( 5 | Rpar, // ) 6 | Lbrack, // [ 7 | Rbrack, // ] 8 | Lcurly, // { 9 | Rcurly, // } 10 | Plus, 11 | Minus, 12 | Equal, 13 | EqEq, // == 14 | //Exclam, // ! 15 | NotEq, // != 16 | Lesser, // < 17 | Greater, // > 18 | LesserEq, 19 | GreaterEq, 20 | Star, // * 21 | Div, // / 22 | FloatDiv, // /. 23 | Percent, // % 24 | Or, 25 | And, // & 26 | Int, 27 | Float, 28 | Pow, 29 | Dot, 30 | QuotedStr, // " 31 | Bool, 32 | Null, 33 | Var, 34 | ReadIn, 35 | WriteOut, 36 | If, 37 | While, 38 | Break, 39 | Continue, 40 | Else, 41 | Endline, 42 | WS, // white space(s) 43 | UNK, 44 | /* -----=====----- */ 45 | // Grammar Constructs 46 | // used by the parser, not the lexer 47 | Program, 48 | Line, 49 | Assign, 50 | Input, 51 | Output, 52 | IfLine, 53 | LoopLine, 54 | Expr, 55 | Term, 56 | Pred, 57 | BaseExpr, 58 | Operator, 59 | CondOp, 60 | IfCond, 61 | IfBody, 62 | OptElse, 63 | LoopBody, 64 | Obj, 65 | Str, 66 | Num, 67 | Frac, 68 | List, 69 | ListElem, 70 | ListExpr 71 | }; 72 | 73 | // Generate readable string instead of int 74 | const char* type2char (enum TokenType t); 75 | 76 | struct Token{ 77 | char* lexeme; 78 | enum TokenType type; 79 | }; 80 | 81 | struct TokenList { 82 | struct Token* token; 83 | struct TokenList* next; 84 | }; 85 | 86 | void print_Token(struct Token* p); 87 | 88 | void print_TokenList(struct TokenList* p); 89 | 90 | void free_Token(struct Token* tok); 91 | 92 | void free_TokenList(struct TokenList* tok); 93 | 94 | struct Token* new_Token(char* lexeme, enum TokenType tok); 95 | 96 | struct TokenList* new_TokenList(struct Token* tok); 97 | 98 | /* 99 | * Create a TokenList from the characters stream 100 | * (typically a file with source code). 101 | * Return NULL if the characters sequence is not valid in the Grammar. 102 | */ 103 | struct TokenList* build_TokenList(const char* fp); 104 | 105 | struct TokenList* strip_WS(struct TokenList* list); 106 | -------------------------------------------------------------------------------- /main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "cgen.h" 7 | 8 | // gcc main.c parser.c lexer.c 9 | 10 | 11 | int main_parser(int argc, char* argv[]); 12 | int main_lexer(int argc, char* argv[]); 13 | int main_cgen(int argc, char* argv[]); 14 | 15 | 16 | int main(int argc, char* argv[]) { 17 | //main_parser(argc, argv); 18 | main_cgen(argc, argv); 19 | } 20 | 21 | 22 | int main_cgen(int argc, char* argv[]) { 23 | struct ParseTree *tree, *tmp; 24 | char* code; 25 | int status; 26 | char* outFile; 27 | 28 | if (argc < 2) { 29 | printf("Expecting at the least 1 argument: file path.\n"); 30 | return 1; 31 | } 32 | char const* const fileName = argv[1]; 33 | 34 | tree = alloc_ParseTree(); 35 | if (tree == NULL) 36 | return MEMORY_ERROR; 37 | 38 | status = build_ParseTree_FromFile(fileName, &tree); 39 | print_ParseTree(tree); 40 | 41 | if (status != SUBTREE_OK) { 42 | printf("PARSING ERROR\n"); 43 | return - 1; 44 | } 45 | 46 | //tmp = tree;//->child->child;//->child->child; 47 | //tmp = tmp->sibling->sibling; // Expr 48 | //tmp = tmp->child->child->child->child->child; // Str 49 | 50 | code = code_gen(tree); 51 | if (code == NULL) { 52 | printf("Error in CODE-GEN"); 53 | free_ParseTree(tree); 54 | return -1; 55 | } 56 | printf("Generated code is:\n|\n%s|\n", code); 57 | 58 | if (argc > 2) 59 | outFile = argv[2]; 60 | else 61 | outFile = "./out.py"; 62 | 63 | FILE *fp = fopen(outFile, "w"); 64 | if (fp != NULL) { 65 | fputs(code, fp); 66 | fclose(fp); 67 | } 68 | 69 | free(code); 70 | free_ParseTree(tree); 71 | return status; 72 | 73 | } 74 | 75 | int main_parser(int argc, char* argv[]) { 76 | struct ParseTree *tree; 77 | int status; 78 | 79 | if (argc < 2) { 80 | printf("Expecting exactly 1 argument: file path.\n"); 81 | return 1; 82 | } 83 | char const* const fileName = argv[1]; 84 | 85 | tree = alloc_ParseTree(); 86 | if (tree == NULL) 87 | return MEMORY_ERROR; 88 | 89 | status = build_ParseTree_FromFile(fileName, &tree); 90 | print_ParseTree(tree); 91 | 92 | if (status != SUBTREE_OK) { 93 | printf("PARSING ERROR\n"); 94 | return - 1; 95 | } 96 | 97 | free_ParseTree(tree); 98 | 99 | return status; 100 | } 101 | 102 | 103 | int main_lexer(int argc, char* argv[]) { 104 | /* 105 | const char* line = "+ >= continue<= - \"a b !) c \"\"ah ahd\" ;\n == xyz != +0.53^-2 && a3c!=x + === [ Null)"; 106 | struct Token tok; 107 | tok.lexeme = malloc(16 * sizeof(char)); 108 | tok.type = UNK; 109 | while (next_Token(&line, &tok) > 0) { 110 | print_Token(&tok); 111 | } 112 | free(tok.lexeme); 113 | */ 114 | if (argc < 2) { 115 | printf("Expecting exactly 1 argument: file path.\n"); 116 | return 1; 117 | } 118 | char const* const fileName = argv[1]; 119 | 120 | /* 121 | * Load the file in memory and return a char* to it 122 | */ 123 | FILE* file = fopen(fileName, "r"); 124 | if (file == NULL) { 125 | printf("Cannot read the given file path.\n"); 126 | return -1; 127 | } 128 | struct stat buffer; 129 | int status = stat(fileName, &buffer); 130 | char vec[buffer.st_size + 1]; 131 | size_t read = fread(vec, sizeof(char), buffer.st_size, file); 132 | fclose(file); 133 | vec[buffer.st_size] = '\0'; 134 | const char* fp = vec; 135 | 136 | /* 137 | * Build Token list 138 | */ 139 | // Will also print total count 140 | clock_t begin = clock(); 141 | struct TokenList* list = build_TokenList(fp); 142 | clock_t end = clock(); 143 | 144 | 145 | double time_spent = (double)(end - begin) / CLOCKS_PER_SEC; 146 | printf("Total time spent building Token list = %f\n", time_spent); 147 | 148 | struct TokenList* no_ws = NULL; 149 | /* 150 | * Diplay all Tokens 151 | */ 152 | if (list == NULL) 153 | printf("UNRECOGNIZED SEQUENCE OF CHARACTERS: NOT VALID TOKEN\n"); 154 | else { 155 | print_TokenList(list); 156 | no_ws = strip_WS(list); 157 | print_TokenList(no_ws); 158 | } 159 | free_TokenList(list); 160 | free_TokenList(no_ws); 161 | } 162 | -------------------------------------------------------------------------------- /parser.h: -------------------------------------------------------------------------------- 1 | #include "lexer.h" 2 | 3 | struct ParseTree { 4 | struct Token* data; 5 | struct ParseTree* child; 6 | struct ParseTree* sibling; 7 | }; 8 | 9 | 10 | #define PARSING_ERROR -1 11 | #define SUBTREE_OK 0 12 | #define MEMORY_ERROR 1 13 | 14 | 15 | /* 16 | * Create a new ParseTree from a given Token. 17 | * The Token is COPIED with all its internal data into a new memory loc. 18 | * Therefore when the ParseTree created by this function will be freed, Token* c will not. 19 | * Return NULL if a memory error happens. 20 | */ 21 | struct ParseTree* new_ParseTree(struct Token* c); 22 | 23 | 24 | struct ParseTree* alloc_ParseTree(); 25 | 26 | 27 | void print_ParseTree(struct ParseTree* tree); 28 | 29 | /* 30 | * Free memory for the ParseTree and all its internal data, including children and siblings. 31 | * ParseTrees are built by *cloning* Tokens, so only the clones are freed. 32 | */ 33 | void free_ParseTree(struct ParseTree* tree); 34 | 35 | 36 | int build_ParseTree (struct TokenList* head, struct ParseTree** tree); 37 | 38 | int build_ParseTree_FromFile (const char *fileName, struct ParseTree **tree); 39 | -------------------------------------------------------------------------------- /semantic.h: -------------------------------------------------------------------------------- 1 | #include "parser.h" 2 | 3 | #define _int 0 4 | #define _float 1 5 | #define _string 2 6 | #define _null 3 7 | #define _bool 4 8 | #define _list 5 9 | 10 | #define NODE_OK 100 11 | 12 | #define _undef -100 13 | #define UNDEFINED_SYMBOL -1 14 | #define NODE_TYPE_ERROR -2 15 | #define LIST_TYPE_ERROR -3 16 | #define SEMANTIC_ERROR -4 17 | #define BREAK_OUT_OF_CONTEXT -5 18 | #define CONTINUE_OUT_OF_CONTEXT -6 19 | #define OVERWRITE_TYPE_ERROR -7 20 | 21 | 22 | int resultType_aritm [6][6] = { 23 | /* 24 | Valid for + - * / 25 | Row index is 1st operand type. 26 | Col index is 2nd operand type. 27 | Value is the result type of the operation, 28 | or _undef if the operation is impossible. 29 | */ 30 | 31 | /* int float null string bool list*/ 32 | /* int */ { _int, _float, _undef, _undef, _undef, _undef}, 33 | /* float */ { _float, _float, _undef, _undef, _undef, _undef}, 34 | /* string */{ _undef, _undef, _undef, _undef, _undef, _undef}, 35 | /* bool */ { _undef, _undef, _undef, _undef, _undef, _undef}, 36 | /* null */ { _undef, _undef, _undef, _undef, _undef, _undef}, 37 | /* list */ { _undef, _undef, _undef, _undef, _undef, _undef} 38 | }; 39 | 40 | int resultType_FloatDiv [6][6] = { 41 | /* 42 | Valid for /. 43 | */ 44 | 45 | /* int float null string bool list*/ 46 | /* int */ { _float, _float, _undef, _undef, _undef, _undef}, 47 | /* float */ { _float, _float, _undef, _undef, _undef, _undef}, 48 | /* string */{ _undef, _undef, _undef, _undef, _undef, _undef}, 49 | /* bool */ { _undef, _undef, _undef, _undef, _undef, _undef}, 50 | /* null */ { _undef, _undef, _undef, _undef, _undef, _undef}, 51 | /* list */ { _undef, _undef, _undef, _undef, _undef, _undef} 52 | }; 53 | 54 | 55 | int resultType_compare [6][6] = { 56 | /* 57 | Valid for < > <= >= 58 | Row index is 1st operand type. 59 | Col index is 2nd operand type. 60 | Value is the result type of the operation, 61 | or _undef if the operation is impossible. 62 | */ 63 | /* int float null string bool list*/ 64 | /* int */ { _bool, _bool, _undef, _undef, _undef, _undef}, 65 | /* float */ { _bool, _bool, _undef, _undef, _undef, _undef}, 66 | /* string */{ _undef, _undef, _undef, _undef, _undef, _undef}, 67 | /* bool */ { _undef, _undef, _undef, _undef, _undef, _undef}, 68 | /* null */ { _undef, _undef, _undef, _undef, _undef, _undef}, 69 | /* list */ { _undef, _undef, _undef, _undef, _undef, _undef} 70 | }; 71 | 72 | 73 | int resultType_logic [6][6] = { 74 | /* 75 | Valid for && || != == 76 | Row index is 1st operand type. 77 | Col index is 2nd operand type. 78 | Value is the result type of the operation, 79 | or _undef if the operation is impossible. 80 | */ 81 | /* int float null string bool list */ 82 | /* int */ { _bool, _bool, _bool, _bool, _bool, _undef}, 83 | /* float */ { _bool, _bool, _bool, _bool, _bool, _undef}, 84 | /* string */{ _bool, _bool, _bool, _bool, _bool, _undef}, 85 | /* bool */ { _bool, _bool, _bool, _bool, _bool, _undef}, 86 | /* null */ { _bool, _bool, _bool, _bool, _bool, _undef}, 87 | /* list */ { _undef, _undef, _undef, _undef, _undef, _bool} 88 | }; 89 | 90 | 91 | struct Symbol { 92 | char *sym; 93 | int type; 94 | int list_type; // type of each element if list 95 | }; 96 | 97 | 98 | struct SymbolTable { 99 | // currently implemented as a linked list 100 | struct Symbol *head; 101 | struct SymbolTable *next; 102 | }; 103 | 104 | 105 | struct ContextStack { 106 | // will contain the context given by TokenType 107 | // e.g., Program, LoopLine, etc. 108 | enum TokenType top; 109 | struct ContextStack *next; 110 | }; 111 | 112 | 113 | struct Symbol* new_Sym(char *sym); 114 | struct SymbolTable* alloc_SymbolTable(); 115 | struct Symbol* search_symbol(struct SymbolTable *table, char *lexeme); 116 | 117 | void push_Context(struct ContextStack **stack, enum TokenType type); 118 | enum TokenType pop_Context(struct ContextStack **stack); 119 | void free_Context(struct ContextStack *stack); 120 | struct ContextStack* alloc_Context(); 121 | void print_Context(struct ContextStack *stack); 122 | 123 | int analyze_Program(struct ParseTree *node); 124 | -------------------------------------------------------------------------------- /test_parser/test_1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "../parser.h" 5 | 6 | // gcc test_1.c ../parser.c ../lexer.c -o test_1.out 7 | 8 | 9 | int main() { 10 | struct ParseTree *tree, *walk; 11 | int status; 12 | 13 | char const* const fileName = "./test_code_1"; 14 | 15 | tree = alloc_ParseTree(); 16 | if (tree == NULL) 17 | return MEMORY_ERROR; 18 | 19 | status = build_ParseTree_FromFile(fileName, &tree); 20 | 21 | assert(status == SUBTREE_OK); 22 | 23 | walk = tree; 24 | assert(walk->data->type == Program); 25 | assert(walk->sibling == NULL); 26 | 27 | walk = walk->child; 28 | assert(walk->data->type == Line); 29 | 30 | assert(walk->sibling->data->type == Endline); 31 | assert(walk->sibling->child == NULL); 32 | assert(walk->sibling->sibling == NULL); 33 | 34 | walk = walk->child; 35 | assert(walk->data->type == Input); 36 | assert(walk->sibling == NULL); 37 | 38 | walk = walk->child; 39 | assert(walk->data->type == ReadIn); 40 | assert(walk->child == NULL); 41 | 42 | walk = walk->sibling; 43 | assert(walk->data->type == Var); 44 | assert(walk->sibling == NULL); 45 | assert(walk->child == NULL); 46 | 47 | printf("---------------\n"); 48 | printf("--- TEST OK ---\n"); 49 | printf("---------------\n"); 50 | 51 | free_ParseTree(tree); 52 | return status; 53 | } 54 | -------------------------------------------------------------------------------- /test_parser/test_10.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "../parser.h" 5 | 6 | // gcc test_10.c ../parser.c ../lexer.c -o test_10.out 7 | 8 | 9 | int assert_SimpleTerm(struct ParseTree *subtree, enum TokenType terminal); 10 | int assert_SimpleExpr(struct ParseTree *subtree, enum TokenType terminal); 11 | int assert_SimpleBase(struct ParseTree *subtree, enum TokenType terminal); 12 | int assert_ComplExpr(struct ParseTree *subtree); 13 | int assert_SimplePred(struct ParseTree *subtree, enum TokenType terminal); 14 | 15 | 16 | int main() { 17 | struct ParseTree *tree, *walk, *tmp; 18 | int status; 19 | 20 | char const* const fileName = "./test_code_10"; 21 | 22 | tree = alloc_ParseTree(); 23 | if (tree == NULL) 24 | return MEMORY_ERROR; 25 | 26 | status = build_ParseTree_FromFile(fileName, &tree); 27 | 28 | print_ParseTree(tree); 29 | 30 | assert(status == SUBTREE_OK); 31 | 32 | assert(tree->data->type == Program); 33 | walk = tree->child; 34 | assert(walk->data->type == Line); 35 | assert(walk->sibling->data->type == Endline); 36 | assert(walk->sibling->child == NULL); 37 | 38 | walk = walk->child; 39 | assert(walk->data->type == Assign); 40 | walk = walk->child; 41 | assert(walk->data->type == Var); 42 | walk = walk->sibling; 43 | assert(walk->data->type == Equal); 44 | walk = walk->sibling; 45 | assert(walk->data->type = Expr); 46 | 47 | // Now check the Expr 48 | tmp = walk->child; 49 | assert_SimplePred(tmp, Var); 50 | tmp = tmp->child->child->sibling; 51 | assert(tmp->data->type == FloatDiv); 52 | tmp = tmp->sibling; 53 | assert_SimpleTerm(tmp, Var); 54 | 55 | tmp = walk->child->sibling; 56 | assert(tmp->data->type == GreaterEq); 57 | assert(tmp->child == NULL); 58 | 59 | tmp = tmp->sibling; // big branch 60 | 61 | assert(tmp->data->type == Expr); 62 | walk = tmp; 63 | 64 | tmp = tmp->child; 65 | assert_SimplePred(tmp, Var); 66 | tmp = tmp->child->child; // base expr 67 | tmp = tmp->sibling; 68 | assert(tmp->data->type == Star); 69 | tmp = tmp->sibling; 70 | assert(tmp->data->type == Term); 71 | assert(tmp->sibling == NULL); 72 | tmp = tmp->child; 73 | assert_ComplExpr(tmp); 74 | tmp = tmp->child->sibling; // the expr 75 | tmp = tmp->child; 76 | assert_SimplePred(tmp, Var); 77 | tmp = tmp->child->sibling; 78 | assert(tmp->data->type == Plus); 79 | tmp = tmp->sibling; 80 | assert_SimplePred(tmp, Var); 81 | 82 | tmp = walk->child->child->sibling; // !! 83 | assert(tmp->data->type == Minus); 84 | tmp = tmp->sibling; 85 | assert(tmp->data->type == Pred); 86 | tmp = tmp->child; 87 | assert(tmp->data->type == Term); 88 | tmp = tmp->child; 89 | assert_SimpleBase(tmp, Var); 90 | tmp = tmp->sibling; 91 | assert(tmp->data->type == Star); 92 | tmp = tmp->sibling; 93 | assert(tmp->data->type == Term); 94 | tmp = tmp->child; 95 | assert_ComplExpr(tmp); 96 | // ... 97 | 98 | printf("---------------\n"); 99 | printf("--- TEST OK ---\n"); 100 | printf("---------------\n"); 101 | 102 | free_ParseTree(tree); 103 | return status; 104 | } 105 | 106 | 107 | int assert_SimplePred(struct ParseTree *subtree, enum TokenType terminal) { 108 | assert(subtree->data->type == Pred); 109 | assert(subtree->child->data->type == Term); 110 | assert(subtree->child->child->data->type == BaseExpr); 111 | assert(subtree->child->child->child->data->type == Obj); 112 | assert(subtree->child->child->child->child->data->type == terminal); 113 | if (terminal != Num){ 114 | assert(subtree->child->child->child->child->child == NULL); 115 | assert(subtree->child->child->child->child->sibling == NULL); 116 | } 117 | return 0; 118 | } 119 | 120 | 121 | int assert_SimpleExpr(struct ParseTree *subtree, enum TokenType terminal) { 122 | assert(subtree->data->type == Expr); 123 | assert(subtree->child->data->type == Pred); 124 | assert(subtree->child->child->data->type == Term); 125 | assert(subtree->child->child->child->data->type == BaseExpr); 126 | assert(subtree->child->child->child->child->data->type == Obj); 127 | assert(subtree->child->child->child->child->child->data->type == terminal); 128 | if (terminal != Num){ 129 | assert(subtree->child->child->child->child->child->child == NULL); 130 | assert(subtree->child->child->child->child->child->sibling == NULL); 131 | } 132 | return 0; 133 | } 134 | 135 | int assert_ComplExpr(struct ParseTree *subtree) { 136 | assert(subtree->data->type == BaseExpr); 137 | assert(subtree->child->data->type == Lpar); 138 | assert(subtree->child->child == NULL); 139 | assert(subtree->child->sibling->data->type == Expr); 140 | assert(subtree->child->sibling->sibling->data->type == Rpar); 141 | assert(subtree->child->sibling->sibling->child == NULL); 142 | } 143 | 144 | int assert_SimpleTerm(struct ParseTree *subtree, enum TokenType terminal) { 145 | assert(subtree->data->type == Term); 146 | assert(subtree->child->data->type == BaseExpr); 147 | assert(subtree->child->child->data->type == Obj); 148 | assert(subtree->child->child->child->data->type == terminal); 149 | return 0; 150 | } 151 | 152 | int assert_SimpleBase(struct ParseTree *subtree, enum TokenType terminal) { 153 | assert(subtree->data->type == BaseExpr); 154 | assert(subtree->child->data->type == Obj); 155 | assert(subtree->child->child->data->type == terminal); 156 | return 0; 157 | } 158 | -------------------------------------------------------------------------------- /test_parser/test_11.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "../parser.h" 5 | 6 | // gcc test_11.c ../parser.c ../lexer.c -o test_11.out 7 | 8 | 9 | int assert_SimplePred(struct ParseTree *subtree, enum TokenType terminal); 10 | int assert_SimpleExpr(struct ParseTree *subtree, enum TokenType terminal); 11 | 12 | 13 | int main() { 14 | struct ParseTree *tree, *walk, *tmp; 15 | int status; 16 | 17 | char const* const fileName = "./test_code_11"; 18 | 19 | tree = alloc_ParseTree(); 20 | if (tree == NULL) 21 | return MEMORY_ERROR; 22 | 23 | status = build_ParseTree_FromFile(fileName, &tree); 24 | 25 | assert(status == SUBTREE_OK); 26 | 27 | walk = tree; 28 | assert(walk->data->type == Program); 29 | assert(walk->sibling == NULL); 30 | 31 | walk = walk->child; 32 | assert(walk->data->type == Line); 33 | walk = walk->child; 34 | assert(walk->data->type == Assign); 35 | 36 | walk = walk->child; 37 | assert(walk->data->type == Var); 38 | walk = walk->sibling; 39 | assert(walk->data->type == Equal); 40 | walk = walk->sibling; 41 | assert(walk->data->type == Expr); 42 | assert(walk->sibling == NULL); 43 | 44 | walk = walk->child; 45 | tmp = walk; 46 | assert(walk->data->type == Pred); 47 | assert_SimplePred(walk, Var); 48 | walk = walk->child; 49 | assert(walk->sibling->data->type == Plus); 50 | walk = walk->sibling->sibling; 51 | assert_SimplePred(walk, Var); 52 | 53 | walk = tmp->sibling; 54 | assert(walk->data->type == EqEq); 55 | assert(walk->child == NULL); 56 | walk = walk->sibling; 57 | assert_SimpleExpr(walk, Num); 58 | 59 | 60 | printf("---------------\n"); 61 | printf("--- TEST OK ---\n"); 62 | printf("---------------\n"); 63 | 64 | free_ParseTree(tree); 65 | return status; 66 | } 67 | 68 | 69 | int assert_SimplePred(struct ParseTree *subtree, enum TokenType terminal) { 70 | assert(subtree->data->type == Pred); 71 | assert(subtree->child->data->type == Term); 72 | assert(subtree->child->child->data->type == BaseExpr); 73 | assert(subtree->child->child->child->data->type == Obj); 74 | assert(subtree->child->child->child->child->data->type == terminal); 75 | if (terminal != Num){ 76 | assert(subtree->child->child->child->child->child == NULL); 77 | assert(subtree->child->child->child->child->sibling == NULL); 78 | } 79 | return 0; 80 | } 81 | 82 | 83 | int assert_SimpleExpr(struct ParseTree *subtree, enum TokenType terminal) { 84 | assert(subtree->data->type == Expr); 85 | assert(subtree->child->data->type == Pred); 86 | assert(subtree->child->child->data->type == Term); 87 | assert(subtree->child->child->child->data->type == BaseExpr); 88 | assert(subtree->child->child->child->child->data->type == Obj); 89 | assert(subtree->child->child->child->child->child->data->type == terminal); 90 | if (terminal != Num){ 91 | assert(subtree->child->child->child->child->child->child == NULL); 92 | assert(subtree->child->child->child->child->child->sibling == NULL); 93 | } 94 | return 0; 95 | } 96 | -------------------------------------------------------------------------------- /test_parser/test_2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "../parser.h" 5 | 6 | 7 | int main() { 8 | struct ParseTree *tree, *walk; 9 | int status; 10 | 11 | char const* const fileName = "./test_code_2"; 12 | 13 | tree = alloc_ParseTree(); 14 | if (tree == NULL) 15 | return MEMORY_ERROR; 16 | 17 | status = build_ParseTree_FromFile(fileName, &tree); 18 | 19 | assert(status == SUBTREE_OK); 20 | 21 | walk = tree; 22 | assert(walk->data->type == Program); 23 | assert(walk->sibling == NULL); 24 | 25 | walk = walk->child; 26 | assert(walk->data->type == Line); 27 | 28 | assert(walk->sibling->data->type == Endline); 29 | assert(walk->sibling->child == NULL); 30 | assert(walk->sibling->sibling == NULL); 31 | 32 | walk = walk->child; 33 | assert(walk->data->type == Output); 34 | assert(walk->sibling == NULL); 35 | 36 | walk = walk->child; 37 | assert(walk->data->type == WriteOut); 38 | assert(walk->child == NULL); 39 | 40 | walk = walk->sibling; 41 | assert(walk->data->type == Obj); 42 | assert(walk->sibling == NULL); 43 | 44 | walk = walk->child; 45 | assert(walk->data->type == Num); 46 | assert(walk->sibling == NULL); 47 | 48 | walk = walk->child; 49 | assert(walk->data->type == Float); 50 | assert(walk->sibling == NULL); 51 | 52 | walk = walk->child; 53 | assert(walk->data->type == Int); 54 | assert(walk->sibling == NULL); 55 | assert(walk->child == NULL); 56 | 57 | printf("---------------\n"); 58 | printf("--- TEST OK ---\n"); 59 | printf("---------------\n"); 60 | 61 | free_ParseTree(tree); 62 | return status; 63 | } 64 | -------------------------------------------------------------------------------- /test_parser/test_3.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "../parser.h" 5 | 6 | // gcc test_3.c ../parser.c ../lexer.c -o test_3.out 7 | 8 | 9 | int main() { 10 | struct ParseTree *tree, *walk; 11 | int status; 12 | 13 | char const* const fileName = "./test_code_3"; 14 | 15 | tree = alloc_ParseTree(); 16 | if (tree == NULL) 17 | return MEMORY_ERROR; 18 | 19 | status = build_ParseTree_FromFile(fileName, &tree); 20 | 21 | assert(status == PARSING_ERROR); 22 | 23 | printf("---------------\n"); 24 | printf("--- TEST OK ---\n"); 25 | printf("---------------\n"); 26 | 27 | free_ParseTree(tree); 28 | return status; 29 | } 30 | -------------------------------------------------------------------------------- /test_parser/test_4.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "../parser.h" 5 | 6 | // gcc test_4.c ../parser.c ../lexer.c -o test_4.out 7 | 8 | 9 | int assert_SimplePred(struct ParseTree *subtree, enum TokenType terminal); 10 | int assert_SimpleExpr(struct ParseTree *subtree, enum TokenType terminal); 11 | 12 | 13 | int main() { 14 | struct ParseTree *tree, *walk, *lev1, *line1, *line2; 15 | struct ParseTree *ifcond, *ifbody, *expr1; 16 | int status; 17 | 18 | char const* const fileName = "./test_code_4"; 19 | 20 | tree = alloc_ParseTree(); 21 | if (tree == NULL) 22 | return MEMORY_ERROR; 23 | 24 | status = build_ParseTree_FromFile(fileName, &tree); 25 | 26 | assert(status == SUBTREE_OK); 27 | 28 | walk = tree; 29 | assert(walk->data->type == Program); 30 | assert(walk->sibling == NULL); 31 | 32 | walk = walk->child; 33 | 34 | // Check there are 2 Lines 35 | lev1 = walk; 36 | assert(lev1->data->type == Line); 37 | line1 = lev1->child; 38 | lev1 = lev1->sibling; 39 | assert(lev1->data->type == Endline); 40 | assert(lev1->child == NULL); 41 | lev1 = lev1->sibling; 42 | assert(lev1->data->type == Line); 43 | line2 = lev1->child; 44 | lev1 = lev1->sibling; 45 | assert(lev1->data->type == Endline); 46 | assert(lev1->child == NULL); 47 | assert(lev1->sibling == NULL); 48 | 49 | // Check 1st line 50 | assert(line1->data->type == Assign); 51 | line1 = line1->child; 52 | assert(line1->data->type == Var); 53 | assert(line1->child == NULL); 54 | line1 = line1->sibling; 55 | assert(line1->data->type == Equal); 56 | assert(line1->child == NULL); 57 | line1 = line1->sibling; 58 | assert(line1->data->type == Expr); 59 | assert(line1->sibling == NULL); 60 | line1 = line1->child; 61 | assert(line1->data->type == Pred); 62 | assert(line1->sibling == NULL); 63 | line1 = line1->child; 64 | assert(line1->data->type == Term); 65 | assert(line1->sibling == NULL); 66 | line1 = line1->child; 67 | assert(line1->data->type == BaseExpr); 68 | assert(line1->sibling == NULL); 69 | line1 = line1->child; 70 | assert(line1->data->type == Obj); 71 | assert(line1->sibling == NULL); 72 | line1 = line1->child; 73 | assert(line1->data->type == Str); 74 | assert(line1->sibling == NULL); 75 | line1 = line1->child; 76 | // Check there are 2 quotedstr 77 | assert(line1->data->type == QuotedStr); 78 | assert(line1->child != NULL); 79 | line1 = line1->sibling; 80 | assert(line1->data->type == Plus); 81 | assert(line1->child == NULL); 82 | line1 = line1->sibling; 83 | assert(line1->data->type == QuotedStr); 84 | assert(line1->child != NULL); 85 | assert(line1->sibling == NULL); 86 | 87 | // Check 2nd line 88 | assert(line2->data->type == IfLine); 89 | line2 = line2->child; 90 | assert(line2->data->type == If); 91 | assert(line2->child == NULL); 92 | line2 = line2->sibling; 93 | assert(line2->data->type == IfCond); 94 | ifcond = line2->child; 95 | line2 = line2->sibling; 96 | assert(line2->data->type == IfBody); 97 | ifbody = line2->child; 98 | assert(line2->sibling == NULL); 99 | 100 | // Check ifcondition 101 | assert(ifcond->data->type == Lpar); 102 | assert(ifcond->child == NULL); 103 | expr1 = ifcond->sibling; 104 | assert(expr1->data->type == Expr); 105 | ifcond = expr1->sibling; 106 | assert(ifcond->data->type == Rpar); 107 | assert(ifcond->child == NULL); 108 | assert(ifcond->sibling == NULL); 109 | 110 | expr1 = expr1->child; 111 | assert_SimplePred(expr1, Var); 112 | expr1 = expr1->sibling; 113 | assert(expr1->data->type = EqEq); 114 | expr1 = expr1->sibling; 115 | assert_SimpleExpr(expr1, Num); 116 | 117 | // Check ifbody 118 | assert(ifbody->data->type == Line); 119 | assert(ifbody->child->data->type == Input); 120 | assert(ifbody->child->sibling == NULL); 121 | ifbody = ifbody->sibling; 122 | assert(ifbody->data->type == Endline); 123 | assert(ifbody->child == NULL); 124 | ifbody = ifbody->sibling; 125 | assert(ifbody->data->type == Line); 126 | assert(ifbody->child->data->type == Assign); 127 | assert(ifbody->child->sibling == NULL); 128 | ifbody = ifbody->sibling; 129 | assert(ifbody->data->type == Endline); 130 | assert(ifbody->child == NULL); 131 | assert(ifbody->sibling == NULL); 132 | 133 | printf("---------------\n"); 134 | printf("--- TEST OK ---\n"); 135 | printf("---------------\n"); 136 | 137 | free_ParseTree(tree); 138 | return status; 139 | } 140 | 141 | 142 | int assert_SimplePred(struct ParseTree *subtree, enum TokenType terminal) { 143 | assert(subtree->data->type == Pred); 144 | assert(subtree->child->data->type == Term); 145 | assert(subtree->child->child->data->type == BaseExpr); 146 | assert(subtree->child->child->child->data->type == Obj); 147 | assert(subtree->child->child->child->child->data->type == terminal); 148 | if (terminal != Num){ 149 | assert(subtree->child->child->child->child->child == NULL); 150 | assert(subtree->child->child->child->child->sibling == NULL); 151 | } 152 | return 0; 153 | } 154 | 155 | 156 | int assert_SimpleExpr(struct ParseTree *subtree, enum TokenType terminal) { 157 | assert(subtree->data->type == Expr); 158 | assert(subtree->child->data->type == Pred); 159 | assert(subtree->child->child->data->type == Term); 160 | assert(subtree->child->child->child->data->type == BaseExpr); 161 | assert(subtree->child->child->child->child->data->type == Obj); 162 | assert(subtree->child->child->child->child->child->data->type == terminal); 163 | if (terminal != Num){ 164 | assert(subtree->child->child->child->child->child->child == NULL); 165 | assert(subtree->child->child->child->child->child->sibling == NULL); 166 | } 167 | return 0; 168 | } 169 | -------------------------------------------------------------------------------- /test_parser/test_5.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "../parser.h" 5 | 6 | // gcc test_5.c ../parser.c ../lexer.c -o test_5.out 7 | 8 | 9 | int main() { 10 | struct ParseTree *tree, *walk, *ifcond, *basexpr; 11 | int status; 12 | 13 | char const* const fileName = "./test_code_5"; 14 | 15 | tree = alloc_ParseTree(); 16 | if (tree == NULL) 17 | return MEMORY_ERROR; 18 | 19 | status = build_ParseTree_FromFile(fileName, &tree); 20 | 21 | assert(status == SUBTREE_OK); 22 | 23 | print_ParseTree(tree); 24 | 25 | walk = tree; 26 | assert(walk->data->type == Program); 27 | assert(walk->sibling == NULL); 28 | 29 | walk = walk->child; 30 | 31 | assert(walk->data->type == Line); 32 | assert(walk->sibling->data->type == Endline); 33 | assert(walk->sibling->sibling == NULL); 34 | assert(walk->sibling->child == NULL); 35 | walk = walk->child; 36 | 37 | assert(walk->data->type == LoopLine); 38 | assert(walk->sibling == NULL); 39 | walk = walk->child; 40 | 41 | assert(walk->data->type == While); 42 | assert(walk->child == NULL); 43 | walk = walk->sibling; 44 | 45 | assert(walk->data->type == IfCond); 46 | assert(walk->child != NULL); 47 | ifcond = walk; // to check later 48 | walk = walk->sibling; 49 | 50 | assert(walk->data->type == Program); 51 | assert(walk->sibling == NULL); 52 | walk = walk->child; 53 | 54 | // Check the loop condition 55 | ifcond = ifcond->child; 56 | assert(ifcond->data->type == Lpar); 57 | assert(ifcond->child == NULL); 58 | ifcond = ifcond->sibling; 59 | assert(ifcond->data->type == Expr); 60 | assert(ifcond->child->data->type == Pred); 61 | assert(ifcond->child->child->data->type == Term); 62 | assert(ifcond->child->child->child->data->type == BaseExpr); 63 | basexpr = ifcond->child->child->child; 64 | assert(basexpr->child->data->type == Obj); 65 | assert(basexpr->child->child->data->type == Var); 66 | ifcond = ifcond->child->sibling; 67 | assert(ifcond->data->type == Lesser); 68 | ifcond = ifcond->sibling; 69 | assert(ifcond->data->type == Expr); 70 | assert(ifcond->child->data->type == Pred); 71 | assert(ifcond->child->child->data->type == Term); 72 | assert(ifcond->child->child->child->data->type == BaseExpr); 73 | basexpr = ifcond->child->child->child; 74 | assert(basexpr->child->data->type == Obj); 75 | assert(basexpr->child->child->data->type == Num); 76 | 77 | // Check that there are 3 Lines and 3 Endlines 78 | assert(walk->data->type == Line); 79 | assert(walk->child->data->type == Assign); 80 | assert(walk->child->sibling == NULL); 81 | 82 | walk = walk->sibling; 83 | assert(walk->data->type == Endline); 84 | assert(walk->child == NULL); 85 | 86 | walk = walk->sibling; 87 | assert(walk->data->type == Line); 88 | assert(walk->child->data->type == Output); 89 | assert(walk->child->sibling == NULL); 90 | 91 | walk = walk->sibling; 92 | assert(walk->data->type == Endline); 93 | assert(walk->child == NULL); 94 | 95 | walk = walk->sibling; 96 | assert(walk->data->type == Line); 97 | assert(walk->child->data->type == Break); 98 | assert(walk->child->child == NULL); 99 | assert(walk->child->sibling == NULL); 100 | 101 | walk = walk->sibling; 102 | assert(walk->data->type == Endline); 103 | assert(walk->child == NULL); 104 | assert(walk->sibling == NULL); 105 | 106 | printf("---------------\n"); 107 | printf("--- TEST OK ---\n"); 108 | printf("---------------\n"); 109 | 110 | free_ParseTree(tree); 111 | return status; 112 | } 113 | -------------------------------------------------------------------------------- /test_parser/test_6.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "../parser.h" 5 | 6 | // gcc test_6.c ../parser.c ../lexer.c -o test_6.out 7 | 8 | 9 | int main() { 10 | struct ParseTree *tree, *walk; 11 | int status; 12 | 13 | char const* const fileName = "./test_code_6"; 14 | 15 | tree = alloc_ParseTree(); 16 | if (tree == NULL) 17 | return MEMORY_ERROR; 18 | 19 | status = build_ParseTree_FromFile(fileName, &tree); 20 | 21 | assert(status == SUBTREE_OK); 22 | 23 | print_ParseTree(tree); 24 | 25 | walk = tree; 26 | assert(walk->data->type == Program); 27 | assert(walk->sibling == NULL); 28 | 29 | // Quick walk through the tree and check main stuff 30 | 31 | // First main branch 32 | walk = walk->child; 33 | assert(walk->data->type == Line); 34 | walk = walk->child; 35 | assert(walk->data->type == LoopLine); 36 | walk = walk->child->sibling->sibling; 37 | assert(walk->data->type == Program); 38 | walk = walk->child; 39 | assert(walk->child->data->type == Assign); 40 | walk = walk->sibling->sibling->child; 41 | assert(walk->data->type == IfLine); 42 | walk = walk->child->sibling->sibling; 43 | assert(walk->data->type == IfBody); 44 | walk = walk->child->sibling->sibling; 45 | assert(walk->data->type == OptElse); 46 | 47 | // Second main branch 48 | walk = tree->child->sibling->sibling; 49 | assert(walk->child->data->type == IfLine); 50 | walk = walk->sibling; 51 | assert(walk->data->type == Endline); 52 | assert(walk->sibling == NULL); 53 | 54 | printf("---------------\n"); 55 | printf("--- TEST OK ---\n"); 56 | printf("---------------\n"); 57 | 58 | free_ParseTree(tree); 59 | return status; 60 | } 61 | -------------------------------------------------------------------------------- /test_parser/test_7.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "../parser.h" 5 | 6 | // gcc test_7.c ../parser.c ../lexer.c -o test_7.out 7 | 8 | 9 | int main() { 10 | struct ParseTree *tree, *walk; 11 | int status; 12 | 13 | char const* const fileName = "./test_code_7"; 14 | 15 | tree = alloc_ParseTree(); 16 | if (tree == NULL) 17 | return MEMORY_ERROR; 18 | 19 | status = build_ParseTree_FromFile(fileName, &tree); 20 | 21 | assert(status == PARSING_ERROR); 22 | 23 | printf("---------------\n"); 24 | printf("--- TEST OK ---\n"); 25 | printf("---------------\n"); 26 | 27 | free_ParseTree(tree); 28 | return status; 29 | } 30 | -------------------------------------------------------------------------------- /test_parser/test_8.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "../parser.h" 5 | 6 | // gcc test_8.c ../parser.c ../lexer.c -o test_8.out 7 | 8 | 9 | int main() { 10 | struct ParseTree *tree, *walk; 11 | int status; 12 | 13 | char const* const fileName = "./test_code_8"; 14 | 15 | tree = alloc_ParseTree(); 16 | if (tree == NULL) 17 | return MEMORY_ERROR; 18 | 19 | status = build_ParseTree_FromFile(fileName, &tree); 20 | 21 | assert(status == PARSING_ERROR); 22 | 23 | printf("---------------\n"); 24 | printf("--- TEST OK ---\n"); 25 | printf("---------------\n"); 26 | 27 | free_ParseTree(tree); 28 | return status; 29 | } 30 | -------------------------------------------------------------------------------- /test_parser/test_9.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "../parser.h" 5 | 6 | // gcc test_9.c ../parser.c ../lexer.c -o test_9.out 7 | 8 | 9 | int main() { 10 | struct ParseTree *tree, *walk; 11 | int status; 12 | 13 | char const* const fileName = "./test_code_9"; 14 | 15 | tree = alloc_ParseTree(); 16 | if (tree == NULL) 17 | return MEMORY_ERROR; 18 | 19 | status = build_ParseTree_FromFile(fileName, &tree); 20 | 21 | assert(status == PARSING_ERROR); 22 | 23 | printf("---------------\n"); 24 | printf("--- TEST OK ---\n"); 25 | printf("---------------\n"); 26 | 27 | free_ParseTree(tree); 28 | return status; 29 | } 30 | -------------------------------------------------------------------------------- /test_parser/test_code_1: -------------------------------------------------------------------------------- 1 | readInt x; 2 | -------------------------------------------------------------------------------- /test_parser/test_code_10: -------------------------------------------------------------------------------- 1 | a = x /. y >= b * (c+d) - f * (g + (h*k)); 2 | -------------------------------------------------------------------------------- /test_parser/test_code_11: -------------------------------------------------------------------------------- 1 | x = a + b == 1; 2 | -------------------------------------------------------------------------------- /test_parser/test_code_2: -------------------------------------------------------------------------------- 1 | writeOut 5; 2 | -------------------------------------------------------------------------------- /test_parser/test_code_3: -------------------------------------------------------------------------------- 1 | readInt x 2 | -------------------------------------------------------------------------------- /test_parser/test_code_4: -------------------------------------------------------------------------------- 1 | x = "st1 %s", 5 + "st2 %s + %s", 9, 7; 2 | if (x == 5) 3 | readInt y; 4 | z = x + y; 5 | ; 6 | -------------------------------------------------------------------------------- /test_parser/test_code_5: -------------------------------------------------------------------------------- 1 | while (x < 3) 2 | x = x + 1; 3 | writeOut x; 4 | break; 5 | ; 6 | -------------------------------------------------------------------------------- /test_parser/test_code_6: -------------------------------------------------------------------------------- 1 | while (y < x) 2 | z = y % 3; 3 | if (z == 1) 4 | writeOut "ok"; 5 | else 6 | readInt z; 7 | ; 8 | ; 9 | if (y == 7) 10 | j = y; 11 | ; 12 | -------------------------------------------------------------------------------- /test_parser/test_code_7: -------------------------------------------------------------------------------- 1 | while (x +y 2 | writeOut "bad"; 3 | ; 4 | -------------------------------------------------------------------------------- /test_parser/test_code_8: -------------------------------------------------------------------------------- 1 | while (x <= 6 2 | writeOut "bad"; 3 | ; 4 | -------------------------------------------------------------------------------- /test_parser/test_code_9: -------------------------------------------------------------------------------- 1 | if (x <= 6) 2 | writeOut "bad"; 3 | ; 4 | else 5 | k = 2; 6 | ; 7 | --------------------------------------------------------------------------------