[bitc-dev] Implementation of indentation-aware parse
Rick R
rick.richardson at gmail.com
Thu Feb 26 12:36:37 EST 2009
I, personally, really enjoy whitespace delineated blocks in python.
I find them less enjoyable in Haskell, because in practice, there are
a lot more cases in which you must indent, and you must do so
according to slightly less straightforward rules. I still prefer it
to what I would envision symbol delineation to be, however.
That said, I think the short answer to your question is: it must be
hand written. This is simply because you need to maintain the state of
indentation of your current (and previous?) block. Luckily, there is
quite a bit of information on creating parsers for python which might
be useful.
http://docs.python.org/reference/lexical_analysis.html#indentation
http://morepypy.blogspot.com/2008/01/visualizing-python-tokenizer.html
By the way, Hi. I'm Rick. I rediscovered BitC in my quest to find a
method for writing AI for embedded devices. I say rediscovered because
I casually follow cap-talk and E and remember the announcement for
Coyotos and BitC. I hope to be of some help with BitC soon, just
trying to clear my plate 1st.
On Thu, Feb 26, 2009 at 11:48 AM, Jonathan S. Shapiro <shap at eros-os.com> wrote:
> Some languages have used indentation to encode block structure, most
> obviously python. I do not personally like this approach, and I have
> not come to any decision about it, but there is now some empirical
> evidence that (a) users find it more readable, and (b) current
> programmers will elect to use it by choice when the opportunity is
> presented. [c.f. F#].
>
> Can anyone explain how one goes about *implementing* an
> indentation-aware syntax? Does this require a hand parser, or can it
> be done with lexer thuggery? I can probably work it out if I give it
> some thought, but I haven't had a chance to do that.
>
> Thanks
>
>
> shap
> _______________________________________________
> bitc-dev mailing list
> bitc-dev at coyotos.org
> http://www.coyotos.org/mailman/listinfo/bitc-dev
>
--
We can't solve problems by using the same kind of thinking we used
when we created them.
- A. Einstein
More information about the bitc-dev
mailing list