Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Aldebaran, thanks for the kind words and welcome. I'll reply to a few things to get a handle on what direction you're heading.
The truth is that I don't get what goes wrong here, but I think I've framed where it happens. The scoping is hard for me to get my head around, but is it not the implementation of an AST?

The AST is only relevant when it comes to the construction of the DFA that is ultimately used to produce a single valid line of execution. Sub::Genius just takes what FLAT is able to generate as a string derived from the PRE (by way of an equivalent DFA). Are you trying to figure out how to go from the PRE to the DFA? An AST is involved in the conversion from the PRE to the PFA, but after that it is not involved at all.

Thank you for the pointer to the work of the Borweins, I am not a math guy but do enjoy reading about the subject and interesting people around it. Numerical errors notwithstanding, here are some suggestions that I think can help:
  • any word in the PRE represents a subroutine that is called when the "plan" is run; you have access to all the good stuff perl provides, such as AUTOLOAD; this was just a demo of handling subroutines that were not explicitly defined
  • the stubby utility has a new "list" subcommand that will take a PRE and list all valid orderings implied; I added this as a way to more easily see what execution orderings of the subroutines you were admitting
  • there is an error in the pi examples that are corrected in the latest release on CPAN - NUM_THREADS should be 6; but I think you figured that out
  • all parts of perl's memory model hold, see below for what I mean.
Here's an example of running stubby to list all possible valid subroutine execution orderings:
$ stubby list -p "begin ( sub1 & sub2 & sub3 ) end" begin sub1 sub3 sub2 end begin sub1 sub2 sub3 end begin sub2 sub1 sub3 end begin sub2 sub3 sub1 end begin sub3 sub1 sub2 end begin sub3 sub2 sub1 end
Regarding perl's memory model, you may program all subroutines assuming that they can access:
  • globaly variables
  • state variables defined within each sub (to create coroutines)
  • an additional execution scope represented by $scope that can be initialized (or not), then treated as an accumulator that is passed into each sub call and returned via each sub call
My contention is that using the right plan and correct use of the "memory" space, any implicitly shared memory algorithm may be implemented correctly. This remains to be seen, but that's my gut feeling. Note - everything is run sequentially in the perl runtime - thought, there is nothing stopping you from using fork; but that just gets us back to the realities of perl being fundamentally a uniprocess.
Hope that helps! Feel free to send me links to some stuff you've played with here - obviously, PM is not ideal for really swapping code. :-)

In reply to Re^3: a look at Sub::Genius with the debugger, and use v in 2021 by oodler
in thread a look at Sub::Genius with the debugger, and use v in 2021 by Aldebaran

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2022-05-22 10:20 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (80 votes). Check out past polls.