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 --- chapter06/README.ja.md | 2 + chapter06/README.md | 2 + chapter06/docs/06-grammar.ja.md | 86 ----------------------------------------- chapter06/docs/06-grammar.md | 81 -------------------------------------- 4 files changed, 4 insertions(+), 167 deletions(-) delete mode 100644 chapter06/docs/06-grammar.ja.md delete mode 100644 chapter06/docs/06-grammar.md (limited to 'chapter06') diff --git a/chapter06/README.ja.md b/chapter06/README.ja.md index 73e660c9..bc05ae75 100644 --- a/chapter06/README.ja.md +++ b/chapter06/README.ja.md @@ -7,6 +7,8 @@ [前の章: 第5章](../chapter05/README.ja.md) | [次の章: 第7章](../chapter07/README.ja.md) +文法は[第5章](../chapter05/docs/05-grammar.ja.md)から変わりません。 + # 目次 1. [型システムの改訂](#型システムの改訂) diff --git a/chapter06/README.md b/chapter06/README.md index 3a7c7e09..ec44e7bf 100644 --- a/chapter06/README.md +++ b/chapter06/README.md @@ -5,6 +5,8 @@ English | [日本語](README.ja.md) [Previous: Chapter 5](../chapter05/README.md) | [Next: Chapter 7](../chapter07/README.md) +The grammar is unchanged from [Chapter 5](../chapter05/docs/05-grammar.md). + # Table of Contents 1. [Type System Revision](#type-system-revision) diff --git a/chapter06/docs/06-grammar.ja.md b/chapter06/docs/06-grammar.ja.md deleted file mode 100644 index fba9379a..00000000 --- a/chapter06/docs/06-grammar.ja.md +++ /dev/null @@ -1,86 +0,0 @@ -# 第6章の文法 - -[English](06-grammar.md) | 日本語 - -この文書は [原文](06-grammar.md) の日本語訳です。 - - -[第6章に戻る](../README.ja.md) - -```antlrv4 -grammar SimpleLanguage; - -program - : statement+ EOF - ; - -statement - : returnStatement - | declStatement - | blockStatment - | expressionStatement - | ifStatement - ; - -ifStatement - : 'if' '(' expression ')' statement ('else' statement)? - ; - - -expressionStatement - : IDENTIFIER '=' expression ';' - ; - -blockStatement - : '{' statement+ '}' - ; - -declStatement - : 'int' IDENTIFIER '=' expression ';' - ; - -returnStatement - : 'return' expression ';' - ; - -expression - : comparisonExpression - ; - -comparisonExpression - : additiveExpression (('==' | '!='| '>'| '<'| '>='| '<=') additiveExpression)* - ; - -additiveExpression - : multiplicativeExpression (('+' | '-') multiplicativeExpression)* - ; - -multiplicativeExpression - : unaryExpression (('*' | '/') unaryExpression)* - ; - -unaryExpression - : ('-') unaryExpression - | primaryExpression - ; - -primaryExpression - : IDENTIFIER - | INTEGER_LITERAL - | 'true' - | 'false' - | '(' expression ')' - ; - -INTEGER_LITERAL - : [1-9][0-9]* - | [0] - ; - -IDENTIFIER - : NON_DIGIT (NON_DIGIT | DIGIT)* - ; - -NON_DIGIT: [a-zA-Z_]; -DEC_DIGIT: [0-9]; -``` diff --git a/chapter06/docs/06-grammar.md b/chapter06/docs/06-grammar.md deleted file mode 100644 index 2dbde035..00000000 --- a/chapter06/docs/06-grammar.md +++ /dev/null @@ -1,81 +0,0 @@ -# Grammar for Chapter 6 - -English | [日本語](06-grammar.ja.md) - -```antlrv4 -grammar SimpleLanguage; - -program - : statement+ EOF - ; - -statement - : returnStatement - | declStatement - | blockStatment - | expressionStatement - | ifStatement - ; - -ifStatement - : 'if' '(' expression ')' statement ('else' statement)? - ; - - -expressionStatement - : IDENTIFIER '=' expression ';' - ; - -blockStatement - : '{' statement+ '}' - ; - -declStatement - : 'int' IDENTIFIER '=' expression ';' - ; - -returnStatement - : 'return' expression ';' - ; - -expression - : comparisonExpression - ; - -comparisonExpression - : additiveExpression (('==' | '!='| '>'| '<'| '>='| '<=') additiveExpression)* - ; - -additiveExpression - : multiplicativeExpression (('+' | '-') multiplicativeExpression)* - ; - -multiplicativeExpression - : unaryExpression (('*' | '/') unaryExpression)* - ; - -unaryExpression - : ('-') unaryExpression - | primaryExpression - ; - -primaryExpression - : IDENTIFIER - | INTEGER_LITERAL - | 'true' - | 'false' - | '(' expression ')' - ; - -INTEGER_LITERAL - : [1-9][0-9]* - | [0] - ; - -IDENTIFIER - : NON_DIGIT (NON_DIGIT | DIGIT)* - ; - -NON_DIGIT: [a-zA-Z_]; -DEC_DIGIT: [0-9]; -``` -- cgit v1.2.3