Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions textbook/03-parsing.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,18 @@ Thus, it is impossible to construct a regular expression (but possible to constr
Give examples.

### What is a leftmost derivation?
The leftmost derivation is the always the leftmost nonterminal.

### What is a rightmost derivation?
The rightmost derivation is always the rightmost nonterminal.

### What is an ambiguous grammar?

### What is a LL(k) grammar?
LL(k) grammar allows parsing by direct construction of a leftmost derivation, and describe even fewer languages.

### What is a LR(k) grammar?
LR(k)grammar (also known as deterministic context-free grammar) allows parsing with deterministic pushdown automata, but they can only describe deterministic context-free languages.

### What is Backus-Naur Form?

Expand All @@ -127,8 +131,10 @@ It manipulates a stack by choosing an indexing variable within the stack, a curr
> TODO: It'd be nice to have a picture of a pushdown automaton, in a vector format such as SVG.

### What is a deterministic pushdown automaton?
A determinisitic pushdown automaton is any pushdown automaton that is fully determined rather than one that has a decision to make between multiple options. As a result of everything being determined all future states can be fully predicted.

### What is a nondeterministic pushdown automaton?
A nondeterministic pushdown automaton is any automaton which is not deteriministic. As a result it has at least 2 options which may or may not be mutually exclusive. These pushdown automaton can also handle all context free grammers.

### What is a parser?
A parser:
Expand Down
55 changes: 28 additions & 27 deletions textbook/05-semantic-analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ TOPICS:
Semantic Analysis
=================

### What is semantics?
### What are semantics?
<!---
4.1 Overview
-->
Expand All @@ -61,27 +61,28 @@ It does so by evaluating the meaning of syntactically legal strings defined by a
In such a case that the evaluation would be of syntactically illegal strings, the result would be non-computation.
Semantics describes the processes a computer follows when executing a program in that specific language.

###
#### How does this work with the Parse Tree?
<!---
4.1.1 Relation to Parse Tree
-->

The Parse Tree is the means by which multi stage compilers check the semantics of a program in a nonlinear fashion.
Additional a symbol table is added to the Parse Tree during the semantic analysis.
Additionally a symbol table is added to the Parse Tree during the semantic analysis.

###
##### What Input is recieved from the parser?
<!---
4.1.1.1 Input from Parser
-->



### What are static semantics?
#####
<!---
4.1.1.2 Adds Semantic Information to Parse Tree
-->

###


####
<!---
4.1.2 Output to Code Generation Phase
-->
Expand All @@ -91,102 +92,102 @@ Additional a symbol table is added to the Parse Tree during the semantic analysi
4.2 Process
-->

###
####
<!---
4.2.1 Type Checking
-->

###
#####
<!---
4.2.1.1 Verify Type Constraints
-->

###
#####
<!---
4.2.1.2 Static Checking
-->

###
######
<!---
4.2.1.2.1 Done at Compile Time
-->

###
######
<!---
4.2.1.2.2 Dynamic Checking Done at Runtime
-->

###
######
<!---
4.2.1.2.3 Example Languages
-->

###
#######
<!---
4.2.1.2.3.1 Ada
-->

###
#######
<!---
4.2.1.2.3.2 C++
-->

###
#######
<!---
4.2.1.2.3.3 Java
-->

###
#####
<!---
4.2.1.3 Type Safety
-->

###
#####
<!---
4.2.1.4 Types Specified by the Language Specification
-->

###
####
<!---
4.2.2 Object Binding
-->

###
#####
<!---
4.2.2.1 Associates Variable with its Definition
-->

###
#####
<!---
4.2.2.2 Resolve Object References
-->

###
####
<!---
4.2.3 Assignment Operations
-->

###
#####
<!---
4.2.3.1 Data Flow Analysis
-->

###
#####
<!---
4.2.3.2 Definite Assignment Analysis
-->

###
######
<!---
4.2.3.2.1 Ensures Variable are Assigned Before Used
-->

###
######
<!---
4.2.3.2.2 Allows Potential Optimization
-->

###
####
<!---
4.2.4 Produce Errors/Warnings
-->
Expand Down