BTW: here's a fun example of the merge problem: I add the
new syntax:
sprocedure_definition := sadjectives "void" sdeclname
sfun_arg* sopt_traint_eq scompound =>#
This is absolutely the same as the old syntax, except
the word 'void' is used in place of 'proc'. However 'proc'
is a keyword, whereas 'void' is just an identifier which is
spelled 'void'. So I wrote this:
//////////////////////
void g(int x, long *y, z:int)
{
var a = x + int(*y) + z;
println$ a;
}
g (3,&x,5);
/////////////////////////
and was very puzzled to see:
/////////////////////////////////
[EMAIL PROTECTED]:/work/felix/svn/felix/felix/trunk$ f ab//Parsing
Implementation std.flx
//Parsing Implementation ab.flx
Client Error binding expression (add ((add (x, (int (deref y)))), z))
CLIENT ERROR
[lookup_name_in_env]: Name 'y' not found in environment (depth 2)
In ./ab.flx: line 28 col 1 to line 34 col 11
27:
28: void g(int x, long *y, z:int)
29: {
30: var a = x + int(*y) + z;
31: println$ a;
32: }
33:
34: g (3,&x,5);
35:
/////////////////////////////
It works just fine, when 'void' is replaced by 'proc'...
Finally I printed the Felix AST:
call ((((void g) ((int x), long*y, (z:int))) (fun () = {
var a = x+(int (deref y))+z;
call println a;
})) g) (3, &(x), 5);
WOOPS! It really did interpret this as a function call
not a definition! Note .. dypgen DID parse it as a definition
too .. I added a debug print to the user action .. that's
why I was confused. Dypgen is selecting the wrong interpretation
here .. it's picking the longer parse (one statement) instead
of the two statement parse.
This works tho:
///////////////////////////////////
void g(int x, long *y, z:int)
{
var a = x + int(*y) + z;
println$ a;
};
g (3,&x,5);
//////////////////////////
[Hint: the extra semi-colon after the } character .. ]
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language