On Thu, 2007-05-10 at 23:07 -0700, Erick Tryzelaar wrote: > Would it be LALR if we had a mandatory "end" but an optional thing > after, like these? > > module Act > class Base > def clone > stuff > end > end > end > > module Act > class Base > def clone > stuff > end > end Base > end
Assuming free form (ignoring indents) then no, because this shows an ambiguity: class Base ... end Base = 1 woops. Same here: class Base .. end class Base .. end woops! Throw in ';' and it is different: class Base ... end; Base =1; class Base .. end Base; .. etc. I wouldn't be using Ruby as an example of a good language. I have no idea why it became popular, since it is basically a stolen version of Python that made even more mess than Python does. Same for Lua -- it's a mess. C++ is too. The crap started when the ANSI committee messed C up by adding typedefs. Syntax is contentious because some people, such as myself, read code wholistically by visual pattern matching, so the lexical marks, indentation style, and other layout stuff are quite critical to comprehension. Languages that aren't flexible enough become overburdened with idioms, and those that are too flexible become too personalised for communication. Stuff like the current #statement extensions are conservative: they don't allow arbitrary extension, they demand a lead-in keyword, they demand termination the same way as other statements, and they demand nesting of existing constructions. A statement extension gives you very little you can't do with a procedure call, and it doesn't allow radical language modifications -- and this is desirable, IMHO. We need to keep the extensions in the 'flavour' of Felix so the language remains coherent and consistent .. So actually, we need to make what we have more consistent: quite a few people have said it looks a bit messy and is a bit hard to learn all the stuff and they're right. Just look at the grammar: src/flx_parser.mly to see .. there are LOT of productions to handle a heap of quirky cases. The RIGHT way to build a language, IMHO, is a fairly simple grammar PLUS a lexicon. Most languages do that already. Definitions add nouns (data types, variables) and verbs (procedures, functions) to the lexicon but don't change the language. Felix also has adjectives: inline fun ... for example. Many systems are augmented nicely by adding the concept of 'properties' -- and internally that's just how 'inline' is represented (an entry on a property list). -- 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