Mark Janssen said: > Unattributed > > No its not like those 'compilers' i dont really agree with a compiler > > generating C/C++ and saying its producing native code. I dont really > > believe > > its truely within the statement. Compilers that do that tend to put in alot > > of type saftey code and debugging internals at a high level to get things > > working in other projects i am not saying python compilers here i havent > > analysed enough to say this. > > Hmm, well what I'd personally find interesting from a computer science > point of view is a app that will take a language specification in BNF > (complete with keywords and all) and output C code which is then > compiled to an executable as normal. This is how a front-end should > be designed. A middle-layer for translating common language elements > like lists, sets, etc, could make it easy.
Taking this starting sortie I was going to try to justify what Mark is saying. Somewhat along the following lines. Things like lex and yacc (and equivalents in ecosystems other than C) give a kind of holy-grail in the following sense. When a writer of a lex/yacc spec does his thing, he does not need to think at the C level at all. Given that executable C is produced (and ignoring mishaps/bugs like shift-reduce conflicts etc) its a very ideal situation. The yacc-grammar (and its lex-helper) are completely declarative and yet they result in perfectly good ( O(n)) good C code. Taking this cue from the syntax domain one can treat it as a holy grail for semantics. ie can one specify the semantics of a language completely declaratively and have a lex/yacc *analogous* magic wand and get out a compiler/interpreter etc. Many people have pursued this holy grail but it remains elusive. Some examples: 1. Atribute grammars 2. Utrecht univs UUAG 3. Action semantics etc Note a key word above is "analogous" However when I see this: > Okay. The purpose of BNF (at least as I envision it) is to > produce/specify a *context-free* "grammar". A lexer parses the tokens > specified in the BNF into an Abstract Syntax Tree. If one can produce > such a tree for any given source, the language, in theory, can be > compiled by GCC into an executable. all I will say is "eyes-roll" -- https://mail.python.org/mailman/listinfo/python-list