On Fri, 2007-05-18 at 02:13 -0700, Erick Tryzelaar wrote: > skaller wrote:
> Are you looking for tweaks to the grammar that can parse the same > syntax, or are you also considering changing the syntax and semantics to > make things simpler? Refactoring: that's a complete rewrite, without gratuitous destruction of the ideas. For example, functions have 'adjectives' like 'inline', and also 'properties' like 'requires fred' and I would like to add say user property 'symmetric' meaning f(a,b)=f(b,a) with that specification actually generated as an axiom. So, the 'prefix' adjectives and 'postfix' properties are really the same thing: properties. There should be a 'regular' way of writing properties in various grammatical forms, as there is in English: the bad programmer drank too much coffee the programmer, who was bad, drank too much coffee too much coffee was drunk by the bad programmer Most of the time we want people to add new 'ideas' to *extant* categories, not have to make new grammars. Existing ordinary languages allow that, but only for restricted categories, eg type names, function names. > > setunion: > > | user10 VBARVBAR setunion_list > > | user10 > > > > setunion_list: > > | user10 VBARVBAR setunion_list > > | user10 > > > > user10: > > | user10 USER10 setintersection > > | setintersection > > > > setintersection: > > | arrow AMPERAMPER setintersection_list > > | arrow > > > > setintersection_list: > > | arrow AMPERAMPER setintersection_list > > | arrow > > > > As a curiousity, can we define a function that can use this sugar for > set functions? grep apl2 lpsrc/flx_parser.ipk is your first resort. Chain operators have n terms represented as Ocaml list: Check desugar as well: chain operators like n-ary + are handled there (also with apl2). For types + maps to n-ary sum combinator, for expressions, to left assoc binary "add". Setunion is a chain operator. x || y || z ==> typesetof(x,y,z) and tuple formation is a chain operation. If it were left assoc you'd get typesetof(typesetof(x,y),z) which actually is the same thing at the moment due to my famous cheating and munging. > Oh, and why is user10 named user10? The 'level' at which #infix 10 "&^&^&" myoperator is parsed. If you're looking for level 11 or 9 you're out of luck .. only 10 is implemented. Dypgen can change all that: the grammar can be manipulated during parsing by the user. > > hash_name: > > | HASH hash_name > > | the_name > > > > What's hash_name in this structure? Some hackery I implemented whilst trying to get the kinding system to work so that GADT's could work. The idea was instead of a new construction: kind Nat = | Zero | Succ of Nat we would use: union Nat = | Zero | Succ of Nat and pump it up one meta level like: #Nat // a new kind #Zero // a kind constructor SO where Nat has type TYPE 0, #Nat has type TYPE 1. Unfortunately this didn't work so well and I made a big mess. I abandoned fixing the kinding system temporarily until I can get some support from a category theorist. -- 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