From ab913c881cfd559591fcde3ca1c82c784c5aab87 Mon Sep 17 00:00:00 2001 From: Carol Nichols Date: Tue, 5 May 2015 21:52:21 -0400 Subject: [PATCH] Fill in grammar for Statements Some of this text is duplicated in the reference (and belongs there) so remove it. It says item grammar is the same, so point to that grammar section. --- src/doc/grammar.md | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/doc/grammar.md b/src/doc/grammar.md index 6a2ad874513f..e606b282f5c2 100644 --- a/src/doc/grammar.md +++ b/src/doc/grammar.md @@ -434,26 +434,19 @@ meta_seq : meta_item [ ',' meta_seq ] ? ; ## Statements -**FIXME:** grammar? +```antlr +stmt : decl_stmt | expr_stmt ; +``` ### Declaration statements -**FIXME:** grammar? - -A _declaration statement_ is one that introduces one or more *names* into the -enclosing statement block. The declared names may denote new variables or new -items. +```antlr +decl_stmt : item | let_decl ; +``` #### Item declarations -**FIXME:** grammar? - -An _item declaration statement_ has a syntactic form identical to an -[item](#items) declaration within a module. Declaring an item — a -function, enumeration, structure, type, static, trait, implementation or module -— locally within a statement block is simply a way of restricting its -scope to a narrow region containing all of its uses; it is otherwise identical -in meaning to declaring the item outside the statement block. +See [Items](#items). #### Variable declarations @@ -464,7 +457,9 @@ init : [ '=' ] expr ; ### Expression statements -**FIXME:** grammar? +```antlr +expr_stmt : expr ';' ; +``` ## Expressions