summaryrefslogtreecommitdiff
path: root/chapter13/docs
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2026-10-07 09:53:15 -0700
committerCliff Click <cliffc@acm.org>2026-10-07 09:53:15 -0700
commitb2862f980f3d78012066ef1cc09d4ad58f886c0f (patch)
treebbeab7de6ac8b556911d117989ab4bbc0324ecb5 /chapter13/docs
parent863a6ed0ad723e06c76f392d4fb3a5f6bd22863c (diff)
downloadSimple-b2862f980f3d78012066ef1cc09d4ad58f886c0f.tar.gz
Simple-b2862f980f3d78012066ef1cc09d4ad58f886c0f.zip
Pick up japanese transaltionpr262-doc-followups
A bunch of minor README fixes, missing TOC, grammer cleanup
Diffstat (limited to 'chapter13/docs')
-rw-r--r--chapter13/docs/13-grammar.ja.md136
-rw-r--r--chapter13/docs/13-grammar.md132
2 files changed, 0 insertions, 268 deletions
diff --git a/chapter13/docs/13-grammar.ja.md b/chapter13/docs/13-grammar.ja.md
deleted file mode 100644
index 9f18bc74..00000000
--- a/chapter13/docs/13-grammar.ja.md
+++ /dev/null
@@ -1,136 +0,0 @@
-# 第13章の文法
-
-[English](13-grammar.md) | 日本語
-
-この文書は [原文](13-grammar.md) の日本語訳です。
-
-[第13章に戻る](../README.ja.md)
-
-```antlrv4
-grammar SimpleLanguage;
-
-program
- : statement+ EOF
- ;
-
-statement
- : returnStatement
- | structDeclaration
- | declStatement
- | blockStatement
- | expressionStatement
- | ifStatement
- | whileStatement
- | breakStatement
- | continueStatement
- ;
-
-PRIMTYPE
- : 'int'
- ;
-
-field
- : PRIMTYPE IDENTIFIER ';'
- | structName ('?')? IDENTIFIER ';'
- ;
-
-fields
- : field+
- ;
-
-structDeclaration
- : 'struct' IDENTIFIER '{' fields '}'
- ;
-
-whileStatement
- : 'while' '(' expression ')' statement
- ;
-
-breakStatement
- : 'break' ';'
- ;
-
-continueStatement
- : 'continue' ';'
- ;
-
-ifStatement
- : 'if' '(' expression ')' statement ('else' statement)?
- ;
-
-
-expressionStatement
- : IDENTIFIER '=' expression ';'
- | fieldExpression '=' expression ';'
- ;
-
-blockStatement
- : '{' statement+ '}'
- ;
-
-structName
- : IDENTIFIER
- ;
-
-declStatement
- : PRIMTYPE IDENTIFIER '=' expression ';'
- | structName ('?')? IDENTIFIER '=' expression ';'
- ;
-
-returnStatement
- : 'return' expression ';'
- ;
-
-expression
- : comparisonExpression
- ;
-
-comparisonExpression
- : additiveExpression (('==' | '!='| '>'| '<'| '>='| '<=') additiveExpression)*
- ;
-
-additiveExpression
- : multiplicativeExpression (('+' | '-') multiplicativeExpression)*
- ;
-
-multiplicativeExpression
- : unaryExpression (('*' | '/') unaryExpression)*
- ;
-
-unaryExpression
- : ('-') unaryExpression
- | '!' unaryExpression
- | primaryExpression
- ;
-
-newExpression
- : 'new' IDENTIFIER
- ;
-
-fieldExpression
- : primaryExpression '.' IDENTIFIER
- ;
-
-primaryExpression
- : IDENTIFIER
- | INTEGER_LITERAL
- | 'true'
- | 'false'
- | 'null'
- | newExpression
- | '(' expression ')'
- | fieldExpression
- ;
-
-INTEGER_LITERAL
- : [1-9][0-9]*
- | [0]
- ;
-
-IDENTIFIER
- : NON_DIGIT (NON_DIGIT | DEC_DIGIT)*
- ;
-
-NON_DIGIT: [a-zA-Z_];
-DEC_DIGIT: [0-9];
-```
diff --git a/chapter13/docs/13-grammar.md b/chapter13/docs/13-grammar.md
deleted file mode 100644
index 40cfc432..00000000
--- a/chapter13/docs/13-grammar.md
+++ /dev/null
@@ -1,132 +0,0 @@
-# Grammar for Chapter 13
-
-English | [日本語](13-grammar.ja.md)
-
-```antlrv4
-grammar SimpleLanguage;
-
-program
- : statement+ EOF
- ;
-
-statement
- : returnStatement
- | structDeclaration
- | declStatement
- | blockStatement
- | expressionStatement
- | ifStatement
- | whileStatement
- | breakStatement
- | continueStatement
- ;
-
-PRIMTYPE
- : 'int'
- ;
-
-field
- : PRIMTYPE IDENTIFIER ';'
- | structName ('?')? IDENTIFIER ';'
- ;
-
-fields
- : field+
- ;
-
-structDeclaration
- : 'struct' IDENTIFIER '{' fields '}'
- ;
-
-whileStatement
- : 'while' '(' expression ')' statement
- ;
-
-breakStatement
- : 'break' ';'
- ;
-
-continueStatement
- : 'continue' ';'
- ;
-
-ifStatement
- : 'if' '(' expression ')' statement ('else' statement)?
- ;
-
-
-expressionStatement
- : IDENTIFIER '=' expression ';'
- | fieldExpression '=' expression ';'
- ;
-
-blockStatement
- : '{' statement+ '}'
- ;
-
-structName
- : IDENTIFIER
- ;
-
-declStatement
- : PRIMTYPE IDENTIFIER '=' expression ';'
- | structName ('?')? IDENTIFIER '=' expression ';'
- ;
-
-returnStatement
- : 'return' expression ';'
- ;
-
-expression
- : comparisonExpression
- ;
-
-comparisonExpression
- : additiveExpression (('==' | '!='| '>'| '<'| '>='| '<=') additiveExpression)*
- ;
-
-additiveExpression
- : multiplicativeExpression (('+' | '-') multiplicativeExpression)*
- ;
-
-multiplicativeExpression
- : unaryExpression (('*' | '/') unaryExpression)*
- ;
-
-unaryExpression
- : ('-') unaryExpression
- | '!' unaryExpression
- | primaryExpression
- ;
-
-newExpression
- : 'new' IDENTIFIER
- ;
-
-fieldExpression
- : primaryExpression '.' IDENTIFIER
- ;
-
-primaryExpression
- : IDENTIFIER
- | INTEGER_LITERAL
- | 'true'
- | 'false'
- | 'null'
- | newExpression
- | '(' expression ')'
- | fieldExpression
- ;
-
-INTEGER_LITERAL
- : [1-9][0-9]*
- | [0]
- ;
-
-IDENTIFIER
- : NON_DIGIT (NON_DIGIT | DEC_DIGIT)*
- ;
-
-NON_DIGIT: [a-zA-Z_];
-DEC_DIGIT: [0-9];
-```