On Tue, Mar 7, 2017 at 1:41 PM, Profpatsch <[email protected]> wrote:
> On 17-03-04 08:34pm, Nicolas Pierron wrote:
>> The *.toml manifest file is then parsed (yes, in Nix [3]) to extract
>> [3] https://github.com/mozilla/nixpkgs-mozilla/blob/master/lib/parseTOML.nix
>
> what have you done

I made tool to avoid updating this repository every time there is a
new nightly version of rustc.
This Nix expression is able to parse a 200 kB toml file in less than 1 second.

To make it short:
 - The tokenizer abuse ` builtin.match ` ability to generate a list of
strings out of the captured regex, and avoid deep recursions by
approximating down the number of expected tokens.
 - The parser uses ` builtin.foldl' `, to make some kind of for-loop
which does not consume space and mutate the parser state to
reconstruct the corresponding attribtue set of the *.toml file

If you want more detail, maybe I should present it at the next NixCon.

-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron - http://nbp.name/
_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to