On Sun, 2007-07-15 at 03:36 +1000, skaller wrote: > I have added a new feature to the Felix parser to make this work:
And now this works: /////////////////////////////////////////////// open syntax cstuff; fun f(int x, long *y, z:int):int = { return x + int(*y) + z; } var x = 5L; println$ f (3,&x,5); ////////////////////////////////////////////////// In case you didn't spot it: function parameters can be written in either C or ML style! Here's the syntax extension that makes this work: ////////////////////////////////////////////////////// syntax cstuff { base_type := | "char" =># '`(ast_name "char" ())' | "tiny" =># '`(ast_name "tiny" ())' | "short" =># '`(ast_name "short" ())' | "int" =># '`(ast_name "int" ())' | "long" =># '`(ast_name "long" ())' | "vlong" =># '`(ast_name "vlong" ())' | "utiny" =># '`(ast_name "utiny" ())' | "uchar" =># '`(ast_name "utiny" ())' | "ushort" =># '`(ast_name "ushort" ())' | "uint" =># '`(ast_name "uint" ())' | "ulong" =># '`(ast_name "ulong" ())' | "uvlong" =># '`(ast_name "uvlong" ())' | struct sname =># "`(ast_name ,_2 ())" | union sname =># "`(ast_name ,_2 ())" | class sname =># "`(ast_name ,_2 ())" | enum sname =># "`(ast_name ,_2 ())" ; pointer_type:= | base_type | pointer_type star =># "`(ast_ref ,_1)" ; sparameter := pointer_type sname =># "`(PVar ,_2 ,_1)"; } ///////////////////////////////////////////////// Obviously, incomplete, but notice how with the new Scheme based system we can extend 'sparameter' -- which is not an expression or statement. -- 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 Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language