instaparse

If you're not trampolining your parser, why bother getting up in the morning?
2020-03-05T03:53:01.020Z

I have a question about how to do something in Instaparse. Imagine a string like this:

3 1 John 0 2 Jane 2 1 3 3 Bob 0
The first number is the number of people. Then, for each person, an id, name, number of people they supervise, and list of ids for the people they supervise. So in that example string there are 3 people. Jane (id = 2) supervises John (id = 1) and Bob (id = 3). Can I use Instaparse to parse stuff like that? Specifically, I'm wondering how to read a number n and parse exactly n items after that.

aengelberg 2020-03-05T04:29:47.021Z

sadly Instaparse isn't well suited for situations where you parse a thing and then use that as an input to some later part of the same parser.

2020-03-05T04:30:42.021300Z

Sounds good. Thank you!

zane 2020-03-05T17:28:53.021600Z

Out of curiosity, what would be better suited for situations like that?

thom 2020-03-05T21:43:20.022100Z

https://github.com/youngnh/parsatron might be a better fit

thom 2020-03-05T21:44:07.022600Z

if you have a look at the way let->> can be used in https://github.com/youngnh/parsatron/blob/master/doc/guide.markdown