http://www.is-research.de/info/vmlanguages/tag/lisp/
> --
> You received this message because you are subscribed to the Google Groups "JVM Languages" group.
> To post to this group, send email to jvm-la...@googlegroups.com.
> To unsubscribe from this group, send email to jvm-language...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en.
>
>
--
---- vruz
---- alterius non sit qui suus esse potest
Clojure might qualify as a relatively simple language from the
perspective of code generation.
> I am looking to implement a hand-coded lexer/parser for the language.
Why?
> Thanks and Regards
> Dibyendu
Randall Schulz
They're many times not interchangeable.
:-)
--
You received this message because you are subscribed to the Google Groups "JVM Languages" group.
To post to this group, send email to jvm-la...@googlegroups.com.
To unsubscribe from this group, send email to jvm-language...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en.
Jim
Sent from my iPhone
Patrick
Whenever you want to have a computation task accomplished, you need to, in the end, get those electrons shuffled around the silicon in the right way. Every computational task has an inherent level of complexity that you can't reduce below. This complexity has to manifest itself somewhere between your source code that encodes the computation the way you expressed it, and the electrons being shuffled. You can push the complexity between the layers (your source code, libraries, language runtime, OS, hardware) but it has to be somewhere.
This is also a very theoretical minimum. In practice, our today's implementations of computational systems are still far above their minimal level of complexity - when we discover simplifications, we're incrementally (and likely, asymptotically) approaching the minimum.
(This morning's philosophical thought brought to you by a guy sitting home with flu, unable to do anything much more meaningful.)
Attila.
Pseudo (for pseudo code) http://code.google.com/p/pseudo-language/
It uses Tatoo as parser generator and javac as generator (instead of ASM),
It builds javac Tree and let javac backend generates the bytecode :)
R�mi
I still don't get it. You're familiar with parser generators so you
don't want to use one?
> Regards
Randall Schulz
Listen,
parsing is hard (well, unless your language is LISP). You'll end up wasting lot of time on debugging your parser. Worse, if later you'll want to extend your grammar, you'll likely realize that too is hard in a handwritten parser as you'll have to modify a lot of it. Parser generators exist for a reason; they do a tremendous amount of mundane work instead of you. I would never write a lexer/parser by hand, unless the goal is to amuse myself with exactly that.
There, you can't say we didn't try to warn you :-)
Attila.
>
> Regards
(Edit applied by RRS based on correction from DM.)
> Listen,
>
> parsing is hard (well, unless your language is LISP). You'll end up
> wasting lot of time on debugging your parser. Worse, if later you'll
> want to extend your grammar, you'll likely realize that too is hard
> in a handwritten parser as you'll have to modify a lot of it. Parser
> generators exist for a reason; they do a tremendous amount of mundane
> work instead of you. I would never write a lexer/parser by hand,
> unless the goal is to amuse myself with exactly that.
Seconded.
> There, you can't say we didn't try to warn you :-)
>
> Attila.
Randall Schulz
Yeah, let's start writing a parser generator !
>> There, you can't say we didn't try to warn you :-)
>>
>> Attila.
>
> Randall Schulz
R�mi
Famous last words...
Good luck.
> Regards
RRS
Regards,
Kirk
As an old curmudgeon, I still prefer a hard-written recursive-descent
parser. It's simple, efficient, and much easier to debug. You can set
a breakpoint in the parser and inspect the parser state. You don't have
IDEs getting confused. Yes, some parser-generators have debugging tools
and IDE interfaces, but that's more stuff you need to install and
understand.
(For typical arithmetic with infix operators, one uses an operator
precedence sub-parser.)
Error recovery is a mixed issue: It is easier and more flexible to add
recovery in a hand-written parser, but this is where a generator could pay
off - but note that (for example) learning how to use ANTLR's error
recovery features is another learning hump.
More appealing seems to be a parser library (or language feature), as in
Perl 6 or Scala, but I don't experience with those.
--
--Per Bothner
p...@bothner.com http://per.bothner.com/
All the more reason to use a parser generator tool!
If you have any intention that this language will be released into the
wild, you owe it to those who will take it up after you to put it on a
proper foundation. And even if you don't, you owe it to yourself not to
waste time and effort on a hand-written parser.
> Regards
Randall Schulz
I must agree; certainly if you're designing a language and fiddling
with the syntax. If you're implementing an existing language then you
will presumably have the BNF so a parser generator makes sense.
Groovy is a good example of this. It took us ages to get the small
details of the syntax right (especially the optional semicolon stuff).
An ANTLR grammer would actually have made it harder (unless we'd has a
world class ANTLR wrangler, which we didin't). We ended up with a hand
crafted parser which had numerous idiosyncrasies but got the basics
right. Then it was possible to produce a grammer which removed the
numerous parsing bugs but kept the important characteristics of the
syntax of the language. If you start with BNF you end up with a syntax
which is easy to define and hence easy to parse. What you really want
is a syntax that it's easy for humans to read and write - the two are
not normally compatible.
I think error recovery is less important than it was in the days when
we had one or two batch runs per day. Error location identification is
more important. With virtually instant compilation I can live with a
compiler that doesn't find all the errors in one parse.
John Wilson
In that case, I'd go with a combinator parser approach such as Scala's
combinator parser library. (Now with Packrat Parsing!)
> ...
> --
> --Per Bothner
Randall Schulz
> As an old curmudgeon, I still prefer a hard-written recursive-descent
> parser. It's simple, efficient, and much easier to debug.
I strongly agree. Lua, where code compactness is almost everything,
started out with a yacc parser (and hand-written lexer; in those days
lex produced slow and bulky code) because they were still mutating the
language quite a bit. When the syntax mostly stabilized in Lua 3.0,
they switched to the much smaller recursive descent parser they use
today.
> (For typical arithmetic with infix operators, one uses an operator
> precedence sub-parser.)
I wouldn't even bother, unless you are dealing with a very slow
processor or a language like C with way too many levels of precedence.
> Error recovery is a mixed issue: It is easier and more flexible to add
> recovery in a hand-written parser,
The Lua folks agree. And you have control over what to do, whereas
typical yacc-likes have at least partly hard-coded recovery
strategies.
Regards