summaryrefslogtreecommitdiff
path: root/chapter11/docs
diff options
context:
space:
mode:
Diffstat (limited to 'chapter11/docs')
-rw-r--r--chapter11/docs/11-grammar.md25
-rw-r--r--chapter11/docs/build-graphs.sh9
-rw-r--r--chapter11/docs/graph1.gv2
-rw-r--r--chapter11/docs/graph4.gv2
-rw-r--r--chapter11/docs/graph5.gv2
-rw-r--r--chapter11/docs/graph6.gv2
-rw-r--r--chapter11/docs/graph7.gv2
-rw-r--r--chapter11/docs/graph8.gv2
8 files changed, 19 insertions, 27 deletions
diff --git a/chapter11/docs/11-grammar.md b/chapter11/docs/11-grammar.md
index 0aaf0619..9370024e 100644
--- a/chapter11/docs/11-grammar.md
+++ b/chapter11/docs/11-grammar.md
@@ -11,7 +11,7 @@ statement
: returnStatement
| structDeclaration
| declStatement
- | blockStatment
+ | blockStatment
| expressionStatement
| ifStatement
| whileStatement
@@ -26,7 +26,7 @@ field
fields
: field+
- ;
+ ;
structDeclaration
: 'struct' IDENTIFIER '{' fields '}'
@@ -39,10 +39,10 @@ whileStatement
breakStatement
: 'break' ';'
;
-
+
continueStatement
: 'continue' ';'
- ;
+ ;
ifStatement
: 'if' '(' expression ')' statement ('else' statement)?
@@ -77,26 +77,27 @@ returnStatement
expression
: comparisonExpression
;
-
+
comparisonExpression
: additiveExpression (('==' | '!='| '>'| '<'| '>='| '<=') additiveExpression)*
;
-
+
additiveExpression
- : multiplicativeExpression (('+' | '-') multiplicativeExpression)*
+ : multiplicativeExpression (('+' | '-') multiplicativeExpression)*
;
-
+
multiplicativeExpression
: unaryExpression (('*' | '/') unaryExpression)*
;
unaryExpression
: ('-') unaryExpression
+ | '!' unaryExpression
| primaryExpression
;
newExpression
- : 'new' IDENTIFIER
+ : 'new' IDENTIFIER
;
fieldExpression
@@ -118,11 +119,11 @@ INTEGER_LITERAL
: [1-9][0-9]*
| [0]
;
-
+
IDENTIFIER
: NON_DIGIT (NON_DIGIT | DIGIT)*
;
-
+
NON_DIGIT: [a-zA-Z_];
DEC_DIGIT: [0-9];
-``` \ No newline at end of file
+```
diff --git a/chapter11/docs/build-graphs.sh b/chapter11/docs/build-graphs.sh
deleted file mode 100644
index 839a36ba..00000000
--- a/chapter11/docs/build-graphs.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-dot -Tsvg graph1.gv > graph1.svg
-dot -Tsvg graph2.gv > graph2.svg
-dot -Tsvg graph3.gv > graph3.svg
-dot -Tsvg graph4.gv > graph4.svg
-dot -Tsvg graph5.gv > graph5.svg
-dot -Tsvg graph6.gv > graph6.svg
-dot -Tsvg graph7.gv > graph7.svg
-dot -Tsvg graph8.gv > graph8.svg
-
diff --git a/chapter11/docs/graph1.gv b/chapter11/docs/graph1.gv
index 97815f63..74c54fdb 100644
--- a/chapter11/docs/graph1.gv
+++ b/chapter11/docs/graph1.gv
@@ -73,4 +73,4 @@ return i;
Return25 -> Region23[taillabel=0 color=red];
Return25 -> Load16[taillabel=1];
Return25 -> Phi_224[taillabel=2 color=blue];
-} \ No newline at end of file
+}
diff --git a/chapter11/docs/graph4.gv b/chapter11/docs/graph4.gv
index 190e83dd..f6958ccb 100644
--- a/chapter11/docs/graph4.gv
+++ b/chapter11/docs/graph4.gv
@@ -104,4 +104,4 @@ return v;
Return37 -> If16:p1[taillabel=0 color=red];
Return37 -> new9[taillabel=1];
Return37 -> Phi_230[taillabel=2 color=blue];
-} \ No newline at end of file
+}
diff --git a/chapter11/docs/graph5.gv b/chapter11/docs/graph5.gv
index 9ebc11cb..f89a83ac 100644
--- a/chapter11/docs/graph5.gv
+++ b/chapter11/docs/graph5.gv
@@ -110,4 +110,4 @@ return v;
Return37 -> If16:p1[taillabel=0 color=red];
Return37 -> new9[taillabel=1];
Return37 -> Phi_230[taillabel=2 color=blue];
-} \ No newline at end of file
+}
diff --git a/chapter11/docs/graph6.gv b/chapter11/docs/graph6.gv
index b108c44d..dfd07d7e 100644
--- a/chapter11/docs/graph6.gv
+++ b/chapter11/docs/graph6.gv
@@ -110,4 +110,4 @@ return v;
Return37 -> If16:p1[taillabel=0 color=red];
Return37 -> new9[taillabel=1];
Return37 -> Phi_230[taillabel=2 color=blue];
-} \ No newline at end of file
+}
diff --git a/chapter11/docs/graph7.gv b/chapter11/docs/graph7.gv
index e9e380ff..18be364b 100644
--- a/chapter11/docs/graph7.gv
+++ b/chapter11/docs/graph7.gv
@@ -20,4 +20,4 @@ digraph chapter11 {
edge [ fontname=Helvetica, fontsize=8 ];
Loop8 -> Start2:p0[taillabel=1 color=red];
Loop8 -> Loop8[taillabel=2 color=red constraint=false];
-} \ No newline at end of file
+}
diff --git a/chapter11/docs/graph8.gv b/chapter11/docs/graph8.gv
index 4189dae8..1a7b231d 100644
--- a/chapter11/docs/graph8.gv
+++ b/chapter11/docs/graph8.gv
@@ -42,4 +42,4 @@ return 0;
Return21 -> Con_4[taillabel=1];
Loop8 -> Start2:p0[taillabel=1 color=red];
Loop8 -> Never18:p1[taillabel=2 color=red constraint=false];
-} \ No newline at end of file
+}