On Fri, 2007-05-11 at 14:47 -0400, Jacques Carette wrote: > But I don't understand -- Maple is free form too, yet I can write the > equivalent of > module Act = class Base = fun clone () = stuff end fun end class end module; > and it parses just fine. Ok, so Maple is old-style and this would be > Act := module() Base := class() clone := proc() stuff end fun end class > end module; > but it still only needs the one ;
Felix uses an unambiguous LALR(1) grammar. fun clone () = stuff end fun clone2() = stuff end fun can certainly be parsed correctly .. but not by an unambiguous LALR(1) grammar with a parser like Ocamlyacc. Dypgen or Elkhound could do this since they're GLR, they work by spawning new threads on each ambiguity, so here (see the . in the text): fun clone () = stuff end . fun clone2() = stuff end fun a thread is forked off to start a new fun, and the old one reduced, AND, a thread assumes the 'fun' is 'end fun' and reduces that then continues. The latter thread may actually parse 'clone2() = stuff' as an assignment if Maple allows that .. and fail when it finally hits the unmatched 'end'. You could also do this with a backtracking Earley parser. However you can't parse it with recursive descent. So I'm actually curious how Maple can do this, since it is older than GLR technology. -- 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