From cc1b3ad0c3e2375bff3d0d736b988d41840dcadd Mon Sep 17 00:00:00 2001 From: dos-reis Date: Mon, 10 May 2010 02:32:04 +0000 Subject: Add lambda expression syntax to Boot. * boot/parser.boot (bpLambda): New. * boot/ast.boot (bfLambda): New. * boot/tokens.boot: Add "+->" as token. * interp/cparse.boot: Use lambda expression syntax. * interp/c-util.boot: Likewise. --- src/boot/ast.boot | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/boot/ast.boot') diff --git a/src/boot/ast.boot b/src/boot/ast.boot index 3ad7d4d8..878bb755 100644 --- a/src/boot/ast.boot +++ b/src/boot/ast.boot @@ -112,6 +112,7 @@ structure %Ast == %ConstantDefinition(%Name,%Ast) -- x == y %Definition(%Name,%Ast,%Ast) -- f x == y %Macro(%Name,%List,%Ast) -- m x ==> y + %Lambda(%List,%Ast) -- x +-> x**2 %SuchThat(%Ast) -- | p %Assignment(%Ast,%Ast) -- x := y %While(%Ast) -- while p -- iterator @@ -742,6 +743,13 @@ bfLessp(l,r)== l = 0 => ["PLUSP",r] r = 0 => ["MINUSP", l] ["<",l,r] + +bfLambda(vars,body) == + -- FIXME: Check that we have only names in vars. + vars := + bfTupleP vars => rest vars + [vars] + ["LAMBDA",vars,body] bfMDef (op,args,body) == argl := -- cgit v1.2.3