diff --git a/textbook/03-parsing.md b/textbook/03-parsing.md index 78b10e6..a826f1d 100644 --- a/textbook/03-parsing.md +++ b/textbook/03-parsing.md @@ -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? @@ -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: diff --git a/textbook/05-semantic-analysis.md b/textbook/05-semantic-analysis.md index 06fa44e..ec6aa51 100644 --- a/textbook/05-semantic-analysis.md +++ b/textbook/05-semantic-analysis.md @@ -51,7 +51,7 @@ TOPICS: Semantic Analysis ================= -### What is semantics? +### What are semantics? @@ -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? 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? -### What are static semantics? +##### - -### + + +#### @@ -91,102 +92,102 @@ Additional a symbol table is added to the Parse Tree during the semantic analysi 4.2 Process --> -### +#### -### +##### -### +##### -### +###### -### +###### -### +###### -### +####### -### +####### -### +####### -### +##### -### +##### -### +#### -### +##### -### +##### -### +#### -### +##### -### +##### -### +###### -### +###### -### +####