From 863a6ed0ad723e06c76f392d4fb3a5f6bd22863c Mon Sep 17 00:00:00 2001 From: Jun Kawasaki Date: Tue, 6 Oct 2026 13:01:11 +0900 Subject: docs: add Japanese translations for all chapters --- chapter02/docs/02-grammar.ja.md | 48 +++++++++++++++++++++++++++++++++++++++++ chapter02/docs/02-grammar.md | 2 ++ 2 files changed, 50 insertions(+) create mode 100644 chapter02/docs/02-grammar.ja.md (limited to 'chapter02/docs') diff --git a/chapter02/docs/02-grammar.ja.md b/chapter02/docs/02-grammar.ja.md new file mode 100644 index 00000000..4a36b68e --- /dev/null +++ b/chapter02/docs/02-grammar.ja.md @@ -0,0 +1,48 @@ +# 第2章の文法 + +[English](02-grammar.md) | 日本語 + +この文書は [第2章の文法定義](02-grammar.md) の日本語版です。 +文法定義そのものは原文と同一です。原文の見出しは「Grammar for Chapter 1」ですが、 +このファイルは第2章の算術演算の文法を定義しているため、日本語版の見出しでは第2章としています。 + +[第2章:算術演算に戻る](../README.ja.md) + +```antlrv4 +grammar SimpleLanguage; + +program + : statement EOF + ; + +statement + : 'return' expression ';' + ; + +expression + : additiveExpression + ; + +additiveExpression + : multiplicativeExpression (('+' | '-') multiplicativeExpression)* + ; + +multiplicativeExpression + : unaryExpression (('*' | '/') unaryExpression)* + ; + +unaryExpression + : ('-') unaryExpression + | primaryExpression + ; + +primaryExpression + : INTEGER_LITERAL + | '(' expression ')' + ; + +INTEGER_LITERAL + : [1-9][0-9]* + | [0] + ; +``` diff --git a/chapter02/docs/02-grammar.md b/chapter02/docs/02-grammar.md index ce875eda..762bed5d 100644 --- a/chapter02/docs/02-grammar.md +++ b/chapter02/docs/02-grammar.md @@ -1,5 +1,7 @@ # Grammar for Chapter 1 +English | [日本語](02-grammar.ja.md) + ```antlrv4 grammar SimpleLanguage; -- cgit v1.2.3 From b2862f980f3d78012066ef1cc09d4ad58f886c0f Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Wed, 7 Oct 2026 09:53:15 -0700 Subject: Pick up japanese transaltion A bunch of minor README fixes, missing TOC, grammer cleanup --- chapter02/docs/02-grammar.ja.md | 3 +-- chapter02/docs/02-grammar.md | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'chapter02/docs') diff --git a/chapter02/docs/02-grammar.ja.md b/chapter02/docs/02-grammar.ja.md index 4a36b68e..c08359e3 100644 --- a/chapter02/docs/02-grammar.ja.md +++ b/chapter02/docs/02-grammar.ja.md @@ -3,8 +3,7 @@ [English](02-grammar.md) | 日本語 この文書は [第2章の文法定義](02-grammar.md) の日本語版です。 -文法定義そのものは原文と同一です。原文の見出しは「Grammar for Chapter 1」ですが、 -このファイルは第2章の算術演算の文法を定義しているため、日本語版の見出しでは第2章としています。 +文法定義そのものは原文と同一です。 [第2章:算術演算に戻る](../README.ja.md) diff --git a/chapter02/docs/02-grammar.md b/chapter02/docs/02-grammar.md index 762bed5d..994a398a 100644 --- a/chapter02/docs/02-grammar.md +++ b/chapter02/docs/02-grammar.md @@ -1,4 +1,4 @@ -# Grammar for Chapter 1 +# Grammar for Chapter 2 English | [日本語](02-grammar.ja.md) -- cgit v1.2.3