[antlr-interest] Example of lazy evaluation in string templates ?
Terence Parr
parrt at cs.usfca.edu
Thu Mar 19 10:29:40 PDT 2009
hi. ST uses lazy evaluation in the sense that you can reference any
attribute or template without concern that it will be evaluated until
"the end" (ie., when you call toString()). This allows you to
gradually fill in attributes as it's convenient to compute the as
opposed to when the template references them. the key is to decouple
the order of the output from the order of attribute computation. You
also want to build up the overall output template in any order you
want without concern that things will be evaluated too soon.
This is sort of a poor man's lazy evaluation in the sense that it
doesn't do any dependency graph between values. It simply says make
sure that all your values are set before calling toString.
does that help?
Ter
On Mar 19, 2009, at 4:16 AM, bernard at ballesta.fr wrote:
> Hi,
>
> Does someone know of a real example of lazy evaluation in string
> templates used in conjunction with a grammar or tree grammar.
>
> Best regards
> Bernard
> <bernard.vcf>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
More information about the antlr-interest
mailing list