At 10:01 PM 8/9/00 -0600, Nathan Torkington wrote:
>Would it make sense for the parsing of a Perl program to be done as:
>  - tokenize without rewriting (e.g., use stays as it is)
>  - structure without rewriting (e.g., constant subs are unfolded)
>  - rewrite for optimizations and actual ops

The structure I've been thinking of looks like:

                Program Text
                     |
                     |
                     |
                     V
             +--------------+
             |   Lex/parse  |
             +--------------+
                    |
                Syntax tree
                    |
                    V
             +--------------+
             | Bytecoder    |
             +--------------+
                    |
                Bytecodes
                    |
                    V
             +--------------+
             | Optimizer    |
             +--------------+
                    |
                Optimized
                bytecodes
                    |
                    V
             +--------------+
             | Execution    |
             |  Engine      |
             +--------------+

With each box being replaceable, and the process being freezable between 
boxes. The lexer and parser probably ought to be separated, thinking about 
it, and we probably want to allow folks to wedge at least C code into each 
bit. (I'm not sure whether allowing you to write part of the optimizer in 
perl would be a win, but I suppose if it was saving the byte stream to disk...)

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to