spencertipping / caterwaul

A Javascript-to-Javascript compiler
http://caterwauljs.org
MIT License
176 stars 10 forks source link

capturing inferred blocks based on indentation #1

Open rampall opened 12 years ago

rampall commented 12 years ago

Is there a mechanism to capture inferred blocks say i{ from indentation during lexing similar to the way the inferred semicolon i;?

Guessing by the way catewaul parser works, it must be faster than other conventional parsers that double parse and push indent/outdent tokens, no?

spencertipping commented 12 years ago

Sadly there is no such mechanism right now. The caterwaul parser is so ad-hoc that it would probably be difficult to add support for it. However, it would probably not be difficult to write a simple parser in pegjs and have it generate custom trees. Then you could use the caterwaul macroexpander api with a custom syntax frontend. (This is what I'm planning on doing with the waul precompiler.) On Jan 11, 2012 6:04 AM, "rampall" < reply@reply.github.com> wrote:

Is there a mechanism to capture inferred blocks say i{ from indentation during lexing similar to the way the inferred semicolon i;?

Guessing by the way catewaul parser works, it must be faster than other conventional parsers that double parse and push indent/outdent tokens, no?


Reply to this email directly or view it on GitHub: https://github.com/spencertipping/caterwaul/issues/1

rampall commented 12 years ago

I'll try that out and i'll keep an eye out for the waul precompiler updates.

I have to admit I am amazed (and intimidated at the same time) pouring through Caterwaul code and its acute case of over-documentation! Caterwaul is truly the beast - a magnificient one at that! Keep up the amazing work!