git.annexia.org
/
goals.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
stdlib: Implement split() function.
[goals.git]
/
src
/
parser.mly
diff --git
a/src/parser.mly
b/src/parser.mly
index
eedbddb
..
57a0c5c
100644
(file)
--- a/
src/parser.mly
+++ b/
src/parser.mly
@@
-87,7
+87,7
@@
let do_include env loc filename optflag file =
(* Start nonterminals. *)
%start <Ast.expr Ast.Env.t> file
(* Start nonterminals. *)
%start <Ast.expr Ast.Env.t> file
-%start <Ast.expr> expr
+%start <Ast.expr> expr
_only
%%
file:
%%
file:
@@
-118,6
+118,10
@@
stmt:
let name, params = $1 in
name, Ast.EGoalDefn ($loc, (params, [], [], Some $2))
}
let name, params = $1 in
name, Ast.EGoalDefn ($loc, (params, [], [], Some $2))
}
+ | GOAL ID
+ {
+ $2, Ast.EGoalDefn ($loc, ([], [], [], None))
+ }
| option(PURE) FUNCTION ID params_decl return_decl EQUALS CODE
{
$3, Ast.EFuncDefn ($loc, ($4, $5, $1 <> None, $7))
| option(PURE) FUNCTION ID params_decl return_decl EQUALS CODE
{
$3, Ast.EFuncDefn ($loc, ($4, $5, $1 <> None, $7))
@@
-172,6
+176,13
@@
params:
| LEFT_PAREN separated_list(COMMA, expr) RIGHT_PAREN { $2 }
;
| LEFT_PAREN separated_list(COMMA, expr) RIGHT_PAREN { $2 }
;
+(* This is used by Parse.parse_expr where we have to parse
+ * a standalone string (eg. from the command line).
+ *)
+expr_only:
+ | expr EOF { $1 }
+ ;
+
(* http://gallium.inria.fr/blog/lr-lists/ *)
right_flexible_list(delim, X):
| (* nothing *) { [] }
(* http://gallium.inria.fr/blog/lr-lists/ *)
right_flexible_list(delim, X):
| (* nothing *) { [] }