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/docs/09-grammar.ja.md | |
| parent | 863a6ed0ad723e06c76f392d4fb3a5f6bd22863c (diff) | |
| download | Simple-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 'chapter09/docs/09-grammar.ja.md')
| -rw-r--r-- | chapter09/docs/09-grammar.ja.md | 103 |
1 files changed, 0 insertions, 103 deletions
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]; -``` |
