Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1066834]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2014-09-20 11:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (158 votes), past polls