diff options
| author | Cliff Click <cliffc@acm.org> | 2026-10-07 09:53:15 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2026-10-07 09:53:15 -0700 |
| commit | b2862f980f3d78012066ef1cc09d4ad58f886c0f (patch) | |
| tree | bbeab7de6ac8b556911d117989ab4bbc0324ecb5 /chapter09 | |
| parent | 863a6ed0ad723e06c76f392d4fb3a5f6bd22863c (diff) | |
| download | Simple-pr262-doc-followups.tar.gz Simple-pr262-doc-followups.zip | |
Pick up japanese transaltionpr262-doc-followups
A bunch of minor README fixes, missing TOC, grammer cleanup
Diffstat (limited to 'chapter09')
| -rw-r--r-- | chapter09/README.ja.md | 4 | ||||
| -rw-r--r-- | chapter09/README.md | 4 | ||||
| -rw-r--r-- | chapter09/docs/09-grammar.ja.md | 103 | ||||
| -rw-r--r-- | chapter09/docs/09-grammar.md | 96 |
4 files changed, 5 insertions, 202 deletions
diff --git a/chapter09/README.ja.md b/chapter09/README.ja.md index a0fe23c3..5019f5f9 100644 --- a/chapter09/README.ja.md +++ b/chapter09/README.ja.md @@ -7,6 +7,8 @@ [前の章: 第8章](../chapter08/README.ja.md) | [次の章: 第10章](../chapter10/README.ja.md) +文法は[第8章](../chapter08/docs/08-grammar.ja.md)から変わりません。 + # 目次 1. [ピープホール最適化の基盤づくり](#ピープホール最適化の基盤づくり) @@ -19,8 +21,6 @@ - [例2](#例2) 7. [解析後の反復最適化](#解析後の反復最適化) -> 訳注: 原文の目次の「Other Concerns」は、本文では「Future Work」という見出しです。日本語の目次は本文の見出しに合わせています。 - [linear](https://github.com/SeaOfNodes/Simple/tree/linear) ブランチの直線的な Git のリビジョン履歴で [この章](https://github.com/SeaOfNodes/Simple/tree/linear-chapter09) を読み、前の章と [比較](https://github.com/SeaOfNodes/Simple/compare/linear-chapter08...linear-chapter09) することもできます。 この章では次のことを行います。 diff --git a/chapter09/README.md b/chapter09/README.md index 5cb70860..f900062c 100644 --- a/chapter09/README.md +++ b/chapter09/README.md @@ -5,13 +5,15 @@ English | [日本語](README.ja.md) [Previous: Chapter 8](../chapter08/README.md) | [Next: Chapter 10](../chapter10/README.md) +The grammar is unchanged from [Chapter 8](../chapter08/docs/08-grammar.md). + # Table of Contents 1. [Engineering Peepholes](#engineering-peepholes) 2. [Global Value Numbering](#global-value-numbering) 3. [Post-Parse Iterative Peepholes](#post-parse-iterative-peepholes) 4. [Distant Neighbors](#distant-neighbors) -5. [Other Concerns](#other-concerns) +5. [Future Work](#future-work) 6. [Common SubExpressions via GVN](#common-subexpressions-via-gvn) - [Example 1](#example-1) - [Example 2](#example-2) diff --git a/chapter09/docs/09-grammar.ja.md b/chapter09/docs/09-grammar.ja.md deleted file mode 100644 index f89b449b..00000000 --- a/chapter09/docs/09-grammar.ja.md +++ /dev/null @@ -1,103 +0,0 @@ -# 第9章の文法 - -[English](09-grammar.md) | 日本語 - -この文書は [原文](09-grammar.md) の日本語訳です。 - -> 訳注: 原文の見出しは「Grammar for Chapter 8」ですが、このファイルは第9章に属するため、訳の見出しは第9章としています。文法は原文のまま保持しています。 - - -[第9章に戻る](../README.ja.md) - -```antlrv4 -grammar SimpleLanguage; - -program - : statement+ EOF - ; - -statement - : returnStatement - | declStatement - | blockStatment - | expressionStatement - | ifStatement - | whileStatement - | breakStatement - | continueStatment - ; - -whileStatement - : 'while' '(' expression ')' statement - ; - -breakStatement - : 'break' ';' - ; - -continueStatement - : 'continue' ';' - ; - -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/chapter09/docs/09-grammar.md b/chapter09/docs/09-grammar.md deleted file mode 100644 index 5f6d5209..00000000 --- a/chapter09/docs/09-grammar.md +++ /dev/null @@ -1,96 +0,0 @@ -# Grammar for Chapter 8 - -English | [日本語](09-grammar.ja.md) - -```antlrv4 -grammar SimpleLanguage; - -program - : statement+ EOF - ; - -statement - : returnStatement - | declStatement - | blockStatment - | expressionStatement - | ifStatement - | whileStatement - | breakStatement - | continueStatment - ; - -whileStatement - : 'while' '(' expression ')' statement - ; - -breakStatement - : 'break' ';' - ; - -continueStatement - : 'continue' ';' - ; - -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]; -``` |
