From bb8b80f5eb5e1ebd3fc98fe7c284f5154e1a24a9 Mon Sep 17 00:00:00 2001 From: Colin Davidson Date: Mon, 2 May 2022 16:21:18 -0700 Subject: [PATCH] shuffle to articles/staging --- README.md | 20 +++---- compilers.md => articles/compilers.md | 0 http_to_phy.md => articles/http_to_phy.md | 0 asm.md => staging/asm.md | 0 staging/compilers.md | 73 +++++++++++++++++++++++ perf.md => staging/perf.md | 0 6 files changed, 83 insertions(+), 10 deletions(-) rename compilers.md => articles/compilers.md (100%) rename http_to_phy.md => articles/http_to_phy.md (100%) rename asm.md => staging/asm.md (100%) create mode 100644 staging/compilers.md rename perf.md => staging/perf.md (100%) diff --git a/README.md b/README.md index c3ffd73..5a050db 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ # HMN Education Tree 2022 ## Project Overview -This is intended to be commited to incrementally, +This is intended to be commited to incrementally, stubs can/should be added to existing docs where applicable, ideas for future trees can be submitted as new .md ## Selected topics -### [HTTP to Physical](http_to_phy.md) +### [HTTP to Physical](articles/http_to_phy.md) How does a web request actually get from A to B? @@ -15,7 +15,7 @@ TODO: - Better links to topics - Editing pass / blurb cleanup -### [Compilers: How To Make a Programming Language](compilers.md) +### [Compilers: How To Make a Programming Language](articles/compilers.md) How do I make a simple programming language? @@ -24,16 +24,16 @@ TODO: ## Other topic ideas -`asm.md` -WIP for "How do I understand what my computer is really doing at the bottom level?" -(Better question for this one? Should this be a subtopic instead?) -Needs: +`asm.md` +WIP for "How do I understand what my computer is really doing at the bottom level?" +(Better question for this one? Should this be a subtopic instead?) +Needs: - Subtopics broken out - Header blurb -`perf.md` -WIP for "How do I learn to write faster code?" -Needs: +`perf.md` +WIP for "How do I learn to write faster code?" +Needs: - Subtopics broken out - Header blurb diff --git a/compilers.md b/articles/compilers.md similarity index 100% rename from compilers.md rename to articles/compilers.md diff --git a/http_to_phy.md b/articles/http_to_phy.md similarity index 100% rename from http_to_phy.md rename to articles/http_to_phy.md diff --git a/asm.md b/staging/asm.md similarity index 100% rename from asm.md rename to staging/asm.md diff --git a/staging/compilers.md b/staging/compilers.md new file mode 100644 index 0000000..6d083c7 --- /dev/null +++ b/staging/compilers.md @@ -0,0 +1,73 @@ +# Compilers: How To Make a Programming Language + +Other compiler-related topics out of scope: +- What are programs anyway (Forth, LISP) +- Computation: Turing machines, lambda calculus +- Compiler optimization +- GC (motivated by LISP) + +aesthetics: +- stay motivated; stick close to a c-like, imperative, procedural model because that's what people are used to + +motivation / goals / what questions are we trying to answer: +- I want to be able to make a toy procedural language. + - like C, Algol, JS, Lua, etc. + - possible user motivations: + - I want to make a game scripting language + - I want to make a DSL for my job (and I want syntax highlighting!) +- I want to do simple static analysis of my projects + +ok what do we want to cover +- classical compiler structure (lexer -> parser -> codegen) +- semantic analysis / type checking +- modern compiler structures (IR / SSA, optimization) +- interpreters vs. JITs vs. AOTs vs. "transpilers" +- executables and linkers +- regular expressions? +- regular languages / grammars / language structure / automata + +the c compilation process +- translation units +- preprocessing -> (the whole compilation process) -> object files -> linking +- c compilation model is not in favor any more, don't like compiling all these files separately +- ABIs and FFI +- should maybe be in separate article + +experts / consultants: +- Bill +- NeGate + +## The actual progression + +- Simple expression interpreter (parse and evaluate) +- Classical compiler construction (lex -> parse -> output), semantic analysis / type checking + - motivation: complex structures! recursion! etc. + - many of these resources exist and cover different aspects of the process in different ways +- Grammars and language structure +- Types of output (interpreter vs. AOT vs. JIT, etc.) + - We can probably find resources on specific ones of these +- Modern phases (IR / SSA) + - Mention WASM? +- The terrors of the real world + - Executables, linkers, and debug info + - The C ABI and FFI + - Register allocation +- C is not the only language + - LISP + - Forth + - This could be a whole topic maybe + +## Link dump + +- lua grammar: http://lua-users.org/wiki/LuaGrammar +- pascal railroad diagrams: https://www.cs.utexas.edu/users/novak/grammar.html +- tons of links: https://github.com/aalhour/awesome-compilers +- dragon book: http://ce.sharif.edu/courses/94-95/1/ce414-2/resources/root/Text%20Books/Compiler%20Design/Alfred%20V.%20Aho,%20Monica%20S.%20Lam,%20Ravi%20Sethi,%20Jeffrey%20D.%20Ullman-Compilers%20-%20Principles,%20Techniques,%20and%20Tools-Pearson_Addison%20Wesley%20(2006).pdf +- expression parsing examples: + - pratt parsing and recursive descent: https://journal.stuffwithstuff.com/2011/03/19/pratt-parsers-expression-parsing-made-easy/ + - dunno, not recursive descent: https://www.cs.rochester.edu/u/nelson/courses/csc_173/grammars/parsing.html +- gary bernhardt's compiler from scratch: https://www.destroyallsoftware.com/screencasts/catalog/a-compiler-from-scratch +- lambda calculus interpreter: https://justine.lol/lambda/ + + + diff --git a/perf.md b/staging/perf.md similarity index 100% rename from perf.md rename to staging/perf.md