C syntax with a 'hack' and a caveat should now work in Felix. The syntax is not full C, but these should work:
function definitions variables and parameters like 'int x' typedefs struct union which I think is all of C... :) [Felix enum is already the same as C] Please LOOK at the grammar in flx_nugram.flxh, with DSSL csyntax. The hack is that you will NEED to put a semi-colon after function definitions: int f(int x) { return x; }; //<--- ; needed so that the ambiguity resolver can work: the above statement is ambiguous (it could also be interpreted as a call of (int f) applied to (int x) and { return x; } which are all legal Felix expressions. The parser resolves statement ambiguities in favour of C, not Felix. CAVEAT. There is a problem with function types. Felix has two types of functions: Felix functions, modelled by C++ classes, and C functions. The notations are d -> c // felix function d --> c // C function Calling these is the same .. the difference is in their closures. Felix function closures point at C++ class objects with an apply() method, whereas C function closures are just ordinary C function pointers. THIS thing: int f(int x) { return x; }; defines a FELIX function, not a C function. Thus, you can nest them, etc etc: the above is just an alternate syntax for Felix function definition and is the same as fun f(x:int):int= { return x; }; The question is what to do with typedef int (f)(int); typedef int (*fp)(int); At present these both denote C function pointers: int --> int which isn't really consistent with C syntax function definitions denoting Felix, and not C functions. -- John Skaller <skaller at users dot sf dot net> Felix, successor to C++: http://felix.sf.net ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language