Just looking at the grammar, the alarm bells for me are ...

rule(:line_breaks) { line_break.repeat } # SMELL: repeat default 0, so this
rules can consume nothing.... puts a '?' on the end of the name by
convention. Or change to repeat(1).

rule(:comment) { pound >> (line_break.absent? >> any).repeat.as(:comment) >>
line_break.maybe } # The 'maybe' on line_break I assume is to allow the
file to end at this point.... change this to be line_break | eof where eof
is defined as rule(:eof) { any.absent? }

((interpolation_end.absent? >> phrase.repeat).repeat.as(:interpolation)) ##
This can loop for ever. absent? and repeat don't have to consume anything.

---
"No man is an island... except Philip"


On Mon, Mar 25, 2013 at 6:32 AM, Thomas Ingram <[email protected]>wrote:

> Zach,
>
> Thanks for the tip about ruby-prof; I've never used it before, but it was
> really easy to set up. I ended up using ruby-prof to find a method in
> parslet (Parslet::Atoms::Context#lookup) to hack to output what rule was
> being tried. This prompted me to refactor many of the tests to fix
> incorrect/inconsistent expectations.
>
> Kaspar,
>
> (I'm not sure what you have in mind, so I'll try to be thorough.) I have
> isolated two tests with :focus and pushed to GitHub (lines 530 and 608 in
> spec/rip/compiler/parser_spec.rb). These tests are operating on
> `0.one().two.three()` and `1 + 2 + 3 + 4`, respectively (but without
> backticks). The problem seems to be originating in the
> Rip::Compiler::Parser#phrase set of rules (line 64 in
> lib/rip/compiler/parser.rb).
>
> Thank you so much for taking a look at this. Let me know if you need any
> more information.
>
>
> On Sun, Mar 24, 2013 at 11:34 AM, Kaspar Schiess <[email protected]> wrote:
>
>> On 22.03.13 01:49, Thomas Ingram wrote:
>> > I am working on a new programming language
>> > (https://github.com/rip-lang/rip/tree/take-two), and I'm having trouble
>> > getting to the bottom of some infinite loops. Is there a way to print
>> > out each rule as it gets called, such that I can see the rules that are
>> > recursing? I've tried walking through the code in my head, and I just
>> > don't see it. Any help would be much appreciated. Thank you and thank
>> > you so much for Parslet!
>> Hei Thomas,
>>
>> Help us help you: post an instance of a problem that goes StackError and
>> we'll be surely able to figure out why. Then lather, rinse, repeat :)
>>
>> kaspar
>>
>>
>>
>>
>
>
> --
> Thomas Ingram
>

Reply via email to