mirror of
https://github.com/Ed94/LangStudies.git
synced 2025-06-15 11:31:46 -07:00
EoI : Lectures 1-5 complete
This commit is contained in:
110
App/EoI/Lectures/Lecture.1.2.3.Notes.md
Normal file
110
App/EoI/Lectures/Lecture.1.2.3.Notes.md
Normal file
@ -0,0 +1,110 @@
|
||||
# Pipeline
|
||||
|
||||
Interpretation Involves **RUNTIME SEMANTICS**
|
||||
|
||||
***THE MEANING OF THE PROGRAM MODEL***
|
||||
|
||||
Compliation delegates semantics of runtime behavior to
|
||||
***a TARGET language***
|
||||
|
||||
Interpetation deals with the semantics itself.
|
||||
|
||||
Types of Interpreter **implementation**:
|
||||
* AST-based (recursive)
|
||||
* Bytecode (Virtual Machines)
|
||||
|
||||
Types of Compiler **implementation**:
|
||||
* Ahead-of-time (AOT)
|
||||
* Just-in-time (JIT)
|
||||
|
||||
## Interpeter-AST:
|
||||
|
||||
**Translation Stage:**
|
||||
1. Program Model
|
||||
2. Lexer: Processing into token elements for a parser.
|
||||
* Output : Tokens
|
||||
3. Parser: Syntactic Analysis
|
||||
* Output : Abstract Syntax Tree (AST)
|
||||
|
||||
**Runtime Stage:**
|
||||
4. Interpeter
|
||||
5. Runtime Behavior
|
||||
|
||||
## Interpreter-Bytecode:
|
||||
|
||||
**Translation Stage:**
|
||||
1. Program Model
|
||||
2. Lexer: Processing into token elements for a parser.
|
||||
* Output : Tokens
|
||||
3. Parser: Syntactic Analysis
|
||||
* Output : Abstract Syntax Tree (AST)
|
||||
4. Bytecode Emitter
|
||||
5. Bytecode instructions primed.
|
||||
|
||||
**Runtime Stage:**
|
||||
6. Interpreter
|
||||
7. Runtime Behavior
|
||||
|
||||
|
||||
**Types of Virtual Machine behavior:**
|
||||
* Stack based
|
||||
* Stack for operands and operators
|
||||
* Result is always on top of stack
|
||||
* Register based
|
||||
* Virtual registers
|
||||
* Result in accumulation register
|
||||
* Map to real via register allocation
|
||||
|
||||
## Compiler Ahead-of-Time:
|
||||
1. Program Model
|
||||
2. Lexer: Processing into token elements for a parser.
|
||||
* Output : Tokens
|
||||
3. Parser: Syntactic Analysis
|
||||
* Output : Abstract Syntax Tree (AST)
|
||||
4. Code Generator
|
||||
5. Intermediate representation primed
|
||||
6. Target machine instruction set code generation
|
||||
7. Target machine is intended interpretation platform.
|
||||
8. Runtime Behavior.
|
||||
|
||||
|
||||
## Compiler with LLVM platform:
|
||||
1. Program Model
|
||||
2. Lexer: Processing into token elements for a parser.
|
||||
* Output : Tokens
|
||||
3. Parser: Syntactic Analysis
|
||||
* Output : Abstract Syntax Tree (AST)
|
||||
4. LLVM IR generator
|
||||
5. LLVM Native code generator
|
||||
6. Target machine is intended interpretation platform
|
||||
7. Runtime Behavior.
|
||||
|
||||
|
||||
Lexer, and parser are considered **FRONT-END**.
|
||||
Code Generation or byte-code gen or interpreter ast impelementation gen
|
||||
for target instruction platform is considered **BACK-END**.
|
||||
|
||||
|
||||
## Jit Compiler:
|
||||
1. Program Model
|
||||
2. Lexer: Processing into token elements for a parser.
|
||||
* Output : Tokens
|
||||
3. Parser: Syntactic Analysis
|
||||
* Output : Abstract Syntax Tree (AST)
|
||||
4. Bytecode Emitter
|
||||
5. Bytecode fed to interpeter
|
||||
6. Interetor may code gen immediately to target hardware platform or interpret ast directly.
|
||||
7. Runtime Behavior.
|
||||
|
||||
## Transpiler:
|
||||
1. Program Model in input langauge
|
||||
2. Lexer: Processing into token elements for a parser.
|
||||
* Output : Tokens
|
||||
3. Parser: Syntactic Analysis
|
||||
* Output : Abstract Syntax Tree (AST)
|
||||
4. AST Transformation to target AST
|
||||
5. Code generation
|
||||
6. Program Model in output langauge
|
||||
|
||||
|
||||
|
45
App/EoI/Lectures/Lecture.4.Notes.md
Normal file
45
App/EoI/Lectures/Lecture.4.Notes.md
Normal file
@ -0,0 +1,45 @@
|
||||
# Eva Programming Langauge
|
||||
|
||||
Dynamic programming langauge.
|
||||
|
||||
Simple syntax, functional heart, OOP support.
|
||||
|
||||
## Eva Expressions:
|
||||
```
|
||||
(<type> <op1> <op2> ... <opN>)
|
||||
```
|
||||
|
||||
Example:
|
||||
```
|
||||
(+ 5 10)
|
||||
(set x 15)
|
||||
|
||||
(if (> x 10)
|
||||
(print "ok")
|
||||
(print "error")
|
||||
)
|
||||
```
|
||||
|
||||
```
|
||||
(def foo (bar)
|
||||
(+ bar 10)
|
||||
)
|
||||
```
|
||||
|
||||
```
|
||||
(lambda (x) (* x x) 10)
|
||||
```
|
||||
|
||||
## Design Goals
|
||||
|
||||
* Simple syntax: S-Expression
|
||||
* Everything is an expression
|
||||
* No explicit return, last evalulated expression is the result
|
||||
* First class functions
|
||||
* Static scope: all functions are closures
|
||||
* Lambda functions
|
||||
* Funcitonal programming
|
||||
* Imperative programming
|
||||
* Namespaces and modules
|
||||
* OOP: Class or prototype based.
|
||||
|
0
App/EoI/Lectures/Lecture.6.Notes.md
Normal file
0
App/EoI/Lectures/Lecture.6.Notes.md
Normal file
Reference in New Issue
Block a user