Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: How does Perl do it it's thing?

by bikeNomad (Priest)
on Aug 07, 2001 at 04:51 UTC ( #102661=note: print w/replies, xml ) Need Help??


in reply to How does Perl do it it's thing?

Perl, just like any other compiler or interpreter, knows how to read your programs and convert them into a more machine-friendly form for execution. It uses a number of techniques to do this, including using a table-driven parser that is built by a program called YACC (or Bison) by reading a high-level description of the Perl syntax. Here's an excerpt from that description that handles OR (||) and AND (&&) operations (from perly.y):

expr : expr ANDOP expr { $$ = newLOGOP(OP_AND, 0, $1, $3); } | expr OROP expr { $$ = newLOGOP($2, 0, $1, $3); } | argexpr %prec PREC_LOW ;

This process builds a so-called "parse tree" where each of the operations is represented by a data structure that points to other data structures.

In a compiler that expected to output to machine code, this would be approximately the same, but it would be followed by a pass that would read the parse tree and output machine code. In Perl, instead of making machine code for execution by a real processor, a somewhat higher-level representation is made that is then interpreted and executed by a little program inside Perl.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://102661]
help
Chatterbox?
[stevieb]: choroba my GPS home device is done, at least prototype v1 is. I'm just making sure all of my code does what it says now
[stevieb]: I test/prototype code on my Pi, then I migrate it over to Arduino when it's ready (if that's a better platform for what I'm doing). The whole RPi stuff was for learning at first, then it snowballed. I'm just trying to get my in-house CI...
[stevieb]: ...done, which obviously requires a specific hardware setup.
[stevieb]: I don't write tests for the lower-level distributions (ie. ICs, sensors etc) within those distributions, I have all tests in a master distribution which encompasess all of the sub-modules
[choroba]: so you do kind of "integration testing" only

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2017-06-25 22:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (572 votes). Check out past polls.