On Sun, 2012-02-19 at 14:03 +0200, Left Right wrote:
> Languages: I thought I argued my case, but I'll try to explain again, the
> plugins and the "mothership" compiler need not to run inside the same
> runtime - there is a traditional way to make programs cooperate - pipes,
> stream, well, you know. This is called modular architecture, or, if you
> like that Unix-like approach.
The other approach is to write the compiler front-end in a language
agnostic fashion so that plugins can be derived for a range of
languages, which is my plan.
> Re' ANTLR - well, as I said, it's a tool for generating parsers for certain
> types of grammars, namely LR(1), or, to rephrase it, for LR(k) grammars,
> which can be made into LR(1) - this implies AS3 must be an LR(k) grammar.
> This, in other words, means that AS3 must be a deterministic, context-free
> language, yet it seems to me that it is not.
For anyone old enough and foolish enough to have used lex and yacc (or
flex and bison if you are a little younger,) the C language was held up
as a classic case of a such a difficult-to-nail-down language. It was
impossible to create a yacc grammar for C without warnings as the if {}
else if {} notation is non-deterministic without looking ahead. Yacc had
to guess which rule to apply. Most programming languages are not regular
languages, yet somehow Yacc, GOLD, ANTLR and the like seem to cope. AS3
is a nasty grammar to express with BNF, but with the use of a stateful
lexer and a bit of tweaking, it'll be possible, I'm sure. If it isn't,
then we can all just give up and wait for hell to freeze over (sorry I
meant for Adobe to pull their finger out and do something useful, like
give us the Falcon compiler.)
David.