Lexer, Parser, AST, what now?

lican <licaner@gmail.com>
Tue, 10 Mar 2009 09:24:29 -0700 (PDT)

          From comp.compilers

Related articles
Lexer, Parser, AST, what now? licaner@gmail.com (lican) (2009-03-10)
Re: Lexer, Parser, AST, what now? ang.usenet@gmail.com (2009-03-15)
Re: Lexer, Parser, AST, what now? licaner@gmail.com (lican) (2009-03-17)
Re: Lexer, Parser, AST, what now? ang.usenet@gmail.com (Aaron Gray) (2009-03-18)
| List of all articles for this month |

From: lican <licaner@gmail.com>
Newsgroups: comp.compilers
Date: Tue, 10 Mar 2009 09:24:29 -0700 (PDT)
Organization: Compilers Central
Keywords: optimize, question
Posted-Date: 10 Mar 2009 15:32:36 EDT

Hi!


Recently I wrote a fast lexer and RDP by hand in C++, generated a nice
AST... Then wrote some tree walkers that generated my IR (something
similar to bytecode in Lua). Then I wrote a control flow graph in C#
(will be ported to C++ soon) with DAG inside basic blocks. I have a
general idea how to combine AST walking and CFG creation, but what to
do after that? It looks hacky and the code is not optimized. I would
need at least basic CSE and constant propagation.


Some time ago I read all the books that I can find about compilers and
IR/DAG papers and to be honest they don't help me much. After the AST
part, they get a bit messy, tell me something about TAC and DAG, but
to be honest I learn by examples (important fact, for me reading
without example seems blurry) and the fact that "TAC exists and some
compilers use it" doesn't help me much. I just learned that TAC can be
used to represent DAG and that's it. No example algorithms found that
are used to generate stuff after creating DAG and basic blocks.


I also dug through LLVM, PHP and Lua source codes. They're generally
to big and complex to follow what's happening inside. Also found the
Dao language (nice one), but also, code to complex. Can anyone guide
me to next steps needed for this thing to work?


P.S. Language features: dynamic typing, classes, you can say it's a
PHP - Lua fusion with nicer syntax (in my opinion). I also wrote a
simple VM, with 256 registers (similar to Lua's), but can't run
anything without the code. Please help!



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.