in reply to Re^2: snakes and ladders
in thread snakes and ladders

... then process line by line?

As a proper data structure, not plain text. A data structure has, well, structure. You need that structure to identify which types of tokens you have and what they mean.

I tend to use objects for this, but an ad hoc hash will serve as well for your experiments.

Replies are listed 'Best First'.
Re^4: snakes and ladders
by Logicus (Initiate) on Aug 25, 2011 at 07:16 UTC
    Something like the above? (see earlier comment posted before I saw your comment)
      Very very like. This is what the complier folks call a "parse tree". You can, once you have the tree, "walk" it and evaluate what to do at each node. (This is what Perl does to execute a Perl program.)
        I see.. I'm thinking once built I could also write that exact structure out to a .pm file to save building it again in the future until the source code changes.