instaparse

If you're not trampolining your parser, why bother getting up in the morning?
aengelberg 2017-02-24T00:09:59.000277Z

related:

symbol = #'(?!(->|=)\\b)[+/*<>:&|=^?%#~!-]+'

anthony.naddeo 2017-02-24T00:10:38.000278Z

oh awesome, let me try that now

anthony.naddeo 2017-02-24T00:10:50.000279Z

I had meant to circle back and fix all that stuff on the bottom...

anthony.naddeo 2017-02-24T00:32:31.000280Z

@aengelberg yeah, that's pretty awesome. Thanks a ton. I guess I have some work to do

anthony.naddeo 2017-02-24T00:32:44.000281Z

Its cut nearly in half on JS

aengelberg 2017-02-24T00:34:20.000282Z

just curious, does Elm allow newlines pretty much anywhere there can be whitespace? if so, I would recommend making a universal ws and ows (optional whitespace) that allows whitespace, newlines, and comments, which you can then spam in your grammar anytime you would use <break>.

aengelberg 2017-02-24T00:34:59.000283Z

whitespace and comments are sometimes the trickiest parts of grammar perf

anthony.naddeo 2017-02-24T00:38:03.000284Z

Its pretty flexible with newlines yeah. It does care about indentation (which I haven't attempted to model in anyway). Are you saying that break performs poorly or that it would be easier to maintain if I just settled on fewer whitespace tokens

aengelberg 2017-02-24T00:39:26.000285Z

I don't think anything's wrong with break, but you might run into false negatives i.e. valid Elm code that doesn't parse properly

aengelberg 2017-02-24T00:40:05.000286Z

and making ws easier to reason about makes you less likely to fall into ambiguity traps like two adjacent ws parsers

anthony.naddeo 2017-02-24T00:40:18.000287Z

yeah that's a good point

anthony.naddeo 2017-02-24T00:40:52.000288Z

break probably can go. It was just the result of trial and error when I first picked up the parser, I shouldn't feel particularly attached to it if I can just use ws everywhere

anthony.naddeo 2017-02-24T00:42:03.000289Z

thanks again. This is far more support than I expected

aengelberg 2017-02-24T00:49:24.000290Z

No problem

anthony.naddeo 2017-02-24T00:49:30.000291Z

I think it might also make sense for me to roll comments into a rule similar to that

anthony.naddeo 2017-02-24T00:49:44.000292Z

they too can appear anywhere

aengelberg 2017-02-24T00:50:18.000293Z

Agreed. Your usage of single line comments seemed kind of arbitrary though admittedly I'm not familiar with Elm

anthony.naddeo 2017-02-24T00:50:41.000294Z

yeah its totally arbitrary. I've punted on all inline comments atm

anthony.naddeo 2017-02-24T00:51:37.000295Z

the only challenge was modeling them in a meaningful way. I wanted to be able to convert the tree back into code and preserve the comments, or be able to include data about comments in queries against the parse tree