craff / pacomb

A parsing library that compiles grammars to combinators using elimination of left recursion
MIT License
18 stars 2 forks source link

better prediction for dependent sequence #16

Closed craff closed 5 years ago

craff commented 5 years ago

By adding a charset or parametrized by the expected value in continuation we should be able to use an exact charset for dependent sequence.

This might impact performance a bit for grammar not using dependent sequence, but we could have two variants of the Comb module, with the same interface, selected automatically or not.

This would give the following type for continuation:

type ('a, 'b) cont = Charset.t * ('b env -> 'a -> Charset.t * ('b err -> 'b))

or

type ('a, 'b) cont = Charset.t * ('a -> Charset.t * ('b env -> 'b err -> 'b))

instead of the current

type ('a, 'b) cont = Charset.t * ('b env -> 'a -> 'b err -> 'b)

This way we can get the charset without evaluating the continuation to the end.

craff commented 5 years ago

With scheduler, prediction are not so important... So won't fix.