Hello all, I am using parslet to do some log-file parsing and have run into the "stack level too deep" error, and I am only half-way though with writing the rules for a single line to be parsed. From what I gathered there is no option to easily increase the stack size, it would require rebuilding ruby with some of the C flags set. Is there any other way? Can anyone with parslet experience recommend a method for writing the rules that will reduce the internal recursion necessary? Thank you, Brian -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Quoting PsiPro <arjesins-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> Hello all, > > I am using parslet to do some log-file parsing and have run into the > "stack level too deep" error, and I am only half-way though with > writing the rules for a single line to be parsed. >I don''t know the specific technology in Parslet, but if it''s a typical recursive descent parser, you have to write your rules for lists a particular way, otherwise they become infinite recursion. The two ways are: list ::= word | word list and list ::= word | list word Which ever one you are using, try the other. And try to reduce your grammar to the smallest piece that breaks, and then work with it until it doesn''t. I have been using Ruby and Rails for over 5 years and I have yet to see a stack overflow that wasn''t infinite recursion. HTH, Jeffrey -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> I don''t know the specific technology in Parslet, but if it''s a typical > recursive descent parser, you have to write your rules for lists a particular > way, otherwise they become infinite recursion. > > The two ways are: > > list ::= word | word list > > and > > list ::= word | list wordI followed the parslet convention of ''consuming first'', which is what your saying there I think. I worked around it by simply removing the recursion, not as fancy but it works. I''ll optimize it later.> Which ever one you are using, try the other. And try to reduce your grammar > to the smallest piece that breaks, and then work with it until it doesn''t. > > I have been using Ruby and Rails for over 5 years and I have yet to see a > stack overflow that wasn''t infinite recursion. > > HTH, > Jeffrey-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.