in reply to Understanding the Perl Interpreter
Looking at a compiler without some CS knowledge would be almost impossible I suspect, but an interpreter is somewhat easier
Still there is the parser where some knowledge about grammars(the CS kind), LR-parser, LL-parser, LALR-parser and so on could be useful. Maybe reading about it in wikipedia might give some background. Then you could take a look at lex/yacc and bison (open source software packages to parse computer languages, lex or yacc for the syntax, bison for the semantic) to see how a parser works and even do a simple example with them. But I suspect that perls "Do what I mean" combined with highly optimized code left the perl parser far removed from theory.
Another introducory text you might read would be http://compilers.iecc.com/crenshaw/ even though it is about compilers, you get a lot of background information
Then you should take a look at the internal representation/intermediate language used in perl from the outside. Take a minimal script and look at it with different debugging parameters "-Dx", see perlrun. For example "perl -D1 <yourminimalscript>" would show you how the tokens are translated to terms, expressions, scalars, blocks.... -D8 shows every step of the execution of the intermediate language.
With that background knowledge the source should make much more sense now
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Understanding the Perl Interpreter
by JavaFan (Canon) on Apr 08, 2010 at 10:46 UTC | |
|
Re^2: Understanding the Perl Interpreter
by Anonymous Monk on Apr 08, 2010 at 10:17 UTC |