[Ur] Combinator Parsing in Ur: Anonymous function remains at code generation

Sergey Mironov grrwlf at gmail.com
Sat Jul 19 14:23:38 EDT 2014


Hi!
I didn't try writing a parser generator in Ur/Web but I am very
interested in this task. Instead, I sketched some other basic monads,
the code is located here:

https://github.com/grwlf/urweb-monad-pack

I am not sure it helps you in your situation (AFAIK 'lambda remains in
code generation' is a serious thing indicating that Ur/Web compiler
reached it's borders) but if it is, I'll be happy.

Also, the situation where Ur/Web is able to compile one function call
but fails to compile two or more calls is quite common. Often it could
be worked out by explicitly writing function's signature.
Unfortunately, it doesn't work always. I'll start a new thread with
yet another case I found recently.

Regards,
Sergey



2014-07-19 19:42 GMT+04:00 orchidaceae phalaenopsis <orchid.hybrid at gmail.com>:
>> Ur/Web programs that are moderately higher-order (on the server side) will
> often fail to compile
>
> So it looks like if I want to implement a comenting system that allows
> user input markdown syntax or a wiki that allows syntax similar to
> mediawiki in Ur/Web I will have to call out to a perl script and use
> some kind of string -> xbody function that breaks the XSS guarantee? I
> don't want markup rendering to be done in the client-side.
>
> Has anyone tried retargetting a parser generator (like ml-yacc or
> something) to Ur, to get first-order parsers?
>
> From your input I tried to implement a less higher order parser
> library, only a slight extension of state monad and there were two
> problems with this:
>
> * Same "Anonymous function remains at code generation" when I tried
> using it to parse arithmetic expressions (but it did allow me to parse
> char 'x' ; char 'y' unlike the parsec attempt)
> * When attempting to run a parser on the empty string:
>
> Error triggers unlimited retry: Couldn't allocate new heap chunk
> contiguously; increasing size to 1024
> Error triggers unlimited retry: Couldn't allocate new heap chunk
> contiguously; increasing size to 131072
> Error triggers unlimited retry: Couldn't allocate new heap chunk
> contiguously; increasing size to 262144
> Error triggers unlimited retry: Couldn't allocate new heap chunk
> contiguously; increasing size to 524288
> Error triggers unlimited retry: Couldn't allocate new heap chunk
> contiguously; increasing size to 1048576
> Error triggers unlimited retry: Couldn't allocate new heap chunk
> contiguously; increasing size to 2097152
> Error triggers unlimited retry: Couldn't allocate new heap chunk
> contiguously; increasing size to 4194304
> Error triggers unlimited retry: Couldn't allocate new heap chunk
> contiguously; increasing size to 8388608
> Error triggers unlimited retry: Couldn't allocate new heap chunk
> contiguously; increasing size to 16777216
> Error triggers unlimited retry: Couldn't allocate new heap chunk
> contiguously; increasing size to 33554432
> Error triggers unlimited retry: Couldn't allocate new heap chunk
> contiguously; increasing size to 67108864
> Error triggers unlimited retry: Couldn't allocate new heap chunk
> contiguously; increasing size to 134217728
> Error triggers unlimited retry: Couldn't allocate new heap chunk
> contiguously; increasing size to 268435456
> Error triggers unlimited retry: Couldn't allocate new heap chunk
> contiguously; increasing size to 536870912
> Error triggers unlimited retry: Couldn't allocate new heap chunk
> contiguously; increasing size to 1073741824
> Error triggers unlimited retry: Couldn't allocate new heap chunk
> contiguously; increasing size to 2147483648
> Error triggers unlimited retry: Couldn't allocate new heap chunk
> contiguously; increasing size to 4294967296
> Error triggers unlimited retry: Couldn't allocate new heap chunk
> contiguously; increasing size to 8589934592
> Segmentation fault
>
> I hope this data is useful to you in improving Ur/Web!
>
> https://github.com/enn/urweb-peg/tree/master
>
> On Fri, Jul 18, 2014 at 1:43 PM, Adam Chlipala <adamc at csail.mit.edu> wrote:
>> I'm traveling now and don't have much time to look into details, but it is
>> expected that Ur/Web programs that are moderately higher-order (on the
>> server side) will often fail to compile.  It may not be possible to use
>> parser combinators on the server side, though it should be fine in client
>> code.  I'll hope to look at your test case next week.
>>
>>
>> On 07/17/2014 10:19 PM, orchidaceae phalaenopsis wrote:
>>
>> Hi! We're trying to implement Parsec in Ur/Web (following
>> http://research.microsoft.com/en-us/um/people/daan/download/papers/parsec-paper.pdf
>> ). When trying to use our implementation we got "Anonymous function
>> remains at code generation".
>>
>>
>>
>> _______________________________________________
>> Ur mailing list
>> Ur at impredicative.com
>> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
>>
>
> _______________________________________________
> Ur mailing list
> Ur at impredicative.com
> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur



More information about the Ur mailing list