Skip to content
Snippets Groups Projects
Commit f4517c17 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

[project @ 1999-07-26 16:06:28 by simonpj]

Adopt the following syntax for stmts:

	stmts  -> stmt1 ; ... stmtn ; exp [;]

That is, a do-notation thing must finish with an expression.
parent 2c3ba312
No related merge requests found
{-
-----------------------------------------------------------------------------
$Id: Parser.y,v 1.10 1999/06/30 11:29:53 simonmar Exp $
$Id: Parser.y,v 1.11 1999/07/26 16:06:28 simonpj Exp $
Haskell grammar.
......@@ -760,17 +760,20 @@ gdpat :: { RdrNameGRHS }
-- Statement sequences
stmtlist :: { [RdrNameStmt] }
: '{' stmts '}' { reverse $2 }
| layout_on_for_do stmts close { reverse $2 }
: '{' stmts '}' { $2 }
| layout_on_for_do stmts close { $2 }
-- Stmt list must end in an expression
-- thought the H98 report doesn't currently say so in the syntax
stmts :: { [RdrNameStmt] }
: ';' stmts1 { $2 }
| stmts1 { $1 }
: stmts1 srcloc exp { reverse (ExprStmt $3 $2 : $1) }
-- A list of zero or more stmts, ending in semicolon
-- Returned in *reverse* order
stmts1 :: { [RdrNameStmt] }
: stmts1 ';' stmt { $3 : $1 }
| stmts1 ';' { $1 }
| stmt { [$1] }
: stmts1 stmt ';' { $2 : $1 }
| stmts1 ';' { $1 }
| { [] }
stmt :: { RdrNameStmt }
: srcloc infixexp '<-' exp {% checkPattern $2 `thenP` \p ->
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment