I ran across this very interesting page today:
<http://www.llvm.org/docs/tutorial/LangImpl2.html>
This is part of a tutorial for LLVM, in which you implement an entire
(simple) language in about an hour or so. Most of the heavy lifting
is done by LLVM itself, which is a topic for another time (LLVM is an
open-source compiler infrastructure that is very impressive). But
this chapter of the tutorial in particular has some very useful
nuggets for us -- in particular, the operator precedence parsing that
they use to handle binary operators. That would be more efficient
than the approach currently used in the ParserProto (not sure how it
compares to what Morphe2 generates).
I plan to go through this whole tutorial sometime soon (perhaps while
travelling next week, if I can get the LLVM code to work on my
ancient Powerbook). But I'd recommend at least this chapter to
anyone here who's interested in parsing RB code.
Best,
- Joe
--
Joe Strout
Inspiring Applications, Inc.
http://www.InspiringApps.com
|