Skip to content

Instantly share code, notes, and snippets.

@arafatkamaal
Created March 14, 2013 09:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arafatkamaal/5159954 to your computer and use it in GitHub Desktop.
Save arafatkamaal/5159954 to your computer and use it in GitHub Desktop.
Question regarding Perl 6 Grammars
A question regarding Perl 6 Grammars.
I know that Jonathan has created something called as Grammar::Tracer[He has a talk on this: http://www.jnthn.net/papers/2011-yapceu-grammars.pdf], which basically does [as he mentions in the talk]
a. Gives us a trace of all the various rules that our grammar calls as it tries to match.
b. Indicates whether the rule matched or not
c. When it matches, includes the string that was matched.
Now as far as I understand, Perl 6 programs are parsed by a grammar written in Perl 6. In other words, the Perl 6 program is the input data to the Perl 6 grammar.
In that case can we use the Grammar::Tracer module to see what parts of the Perl 6 grammar[Inside the compiler] are called while the Perl 6 program is being parsed? This might sound like going a little too far.
The reason I ask this question is, It will be a great deal of help to newbies who might want to contribute to Rakudo in tasks like fixing bugs. The debug cycle would be simple.
a. Take a program where one thinks there is a bug in Rakudo.
b. Get the grammar trace of the bug.
c. Compare the grammar trace in b) with the correct trace.
d. Fix the difference.
This will also help in understanding the internals of rakudo[Some parts atleast].
Are there any examples, where some one has attempted this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment