Skip to content

Lazy Evaluation

Dávid Németi edited this page Sep 4, 2013 · 2 revisions

The unparser uses lazy evaluation during unparsing.

It means that you do not have to wait for finishing the whole unparsing procedure just to process (i.e. show it to the user) the first few utokens. (Note, that the unparser returns with an IEnumerable<Utoken>, not an ICollection<Utoken>.) This is especially useful if you want to unparse a huge structure, but want to show the user the first page of the unparsed text immediately (you can then continue unparsing in the background, or just wait, and continue if the user wants more pages). You can also easily cancel the unparsing, you just don't ask for more utokens, and you're done.

The unparser's Unparse method has a direction parameter too, so you can unparse not just from the beginning but from the end as well (lazily, of course).

If you are interested in the parallelism of the unparser, continue with Parallelism.

Clone this wiki locally