in reply to Re^2: a look at Sub::Genius with the debugger, and use v in 2021
in thread a look at Sub::Genius with the debugger, and use v in 2021
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:
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. :-)
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.
Regarding perl's memory model, you may program all subroutines assuming that they can access:$ 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
- 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
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 Section
Seekers of Perl Wisdom