summaryrefslogtreecommitdiff
path: root/chapter01/docs
diff options
context:
space:
mode:
Diffstat (limited to 'chapter01/docs')
-rw-r--r--chapter01/docs/01-grammar.ja.md32
-rw-r--r--chapter01/docs/01-grammar.md2
2 files changed, 34 insertions, 0 deletions
diff --git a/chapter01/docs/01-grammar.ja.md b/chapter01/docs/01-grammar.ja.md
new file mode 100644
index 00000000..86e5ab71
--- /dev/null
+++ b/chapter01/docs/01-grammar.ja.md
@@ -0,0 +1,32 @@
+# 第1章の文法
+
+[English](01-grammar.md) | 日本語
+
+この文書は [第1章の文法定義](01-grammar.md) の日本語版です。文法定義そのものは原文と同一です。
+
+[第1章:導入に戻る](../README.ja.md)
+
+```antlrv4
+grammar SimpleLanguage;
+
+program
+ : statement EOF
+ ;
+
+statement
+ : 'return' expression ';'
+ ;
+
+expression
+ : primaryExpression
+ ;
+
+primaryExpression
+ : INTEGER_LITERAL
+ ;
+
+INTEGER_LITERAL
+ : [1-9][0-9]*
+ | [0]
+ ;
+```
diff --git a/chapter01/docs/01-grammar.md b/chapter01/docs/01-grammar.md
index c5ddae2c..1fe965cb 100644
--- a/chapter01/docs/01-grammar.md
+++ b/chapter01/docs/01-grammar.md
@@ -1,5 +1,7 @@
# Grammar for Chapter 1
+English | [日本語](01-grammar.ja.md)
+
```antlrv4
grammar SimpleLanguage;