Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Variables and Scope: The battle begins

by sundialsvc4 (Abbot)
on Dec 12, 2013 at 12:58 UTC ( #1066834=note: print w/replies, xml ) Need Help??

in reply to Variables and Scope: The battle begins

I totally agree.   What you are doing here is creating a fairly brute-force, recursive-descent compiler/assembler ... an approach which makes a program that is every bit as, or more so, complicated as the language that is to be processed.   A far better approach is to use a parser, such as the one listed above, in order to permanently shove “the complexity of the language” into the grammar.

Don’t re-invent this wheel.   Especially not this one.

  • Comment on Re: Variables and Scope: The battle begins

Replies are listed 'Best First'.
Re^2: Variables and Scope: The battle begins
by Shadow-Master (Initiate) on Dec 12, 2013 at 16:30 UTC
    One of the first things I did when started this project was to spend a few hours googling ASM parsers in perl. I found none that did not directly affect registers and stack, instead of variables that acted as registers and stack, so I decided to write my own.
    It seems I was too narrow in my search. This parser you showed me is basically what I want, and had I found it when I started I would have used it, instead of my own.
    As it stands now, I would love to use it, and now need to sit down and figure out how to create grammar rules for ASM instructions (registers, stack, and flags all need to be touched.) and then most likely I will rewrite my whole code and drop several thousand lines from it. :)
    Thus, my new goal is to learn how this works. Of course, any general (or specific!) tips on either my code, or the CPAN parser would be amazing, since as noted above, obviously I don't really know what I'm doing. Thank you all for your help.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1066834]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2018-06-24 23:25 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.