Two languages, too similar, competing in the same space.
Gerson Kurz
gerson.kurz at t-online.de
Sat Dec 29 14:19:59 EST 2001
On Sat, 29 Dec 2001 13:40:16 -0500, Roy Smith <roy at panix.com> wrote:
>gerson.kurz at t-online.de (Gerson Kurz) wrote:
>> Call me oldfashioned, but I don't like exception handling - I like
>> if-then-else and error checking style.
>
>I've been writing lots of parsers lately, for every sort of data file we
>use..Anyway, genericFileParser includes a parseError() method. A
>specific file parser subclass can just do:
>
> If len(blurfl) != 42:
> self.parseError ('bogus length for blurfl')
>
>and you end raising genericFileParser.ParseError with an argument of
>something like 'parse error in file foo.baz, line 47: bogus length for
>blurfl'). The really nice thing is it could have been generated deep in a
>function call chain, and I don't have to worry about propigating the error
>indication back up the chain.
Well, you've certainly come to the right person ;) Check
http://p-nand-q.com/languages.htm
for some programming languages I've written, none of the
implementations require exception handling. Also check out "The Great
Python Language Zoo", a bunch of loosely related programming
languages, all implemented in python and all using the same internal
code representation.
http://p-nand-q.com/gplz/gplz.htm
A very simple syntax plus implementation
http://p-nand-q.com/gplz/dist/easy.txt
Granted, most are not state machines, just backward recursive parsers
- but that's ok by my book ;)
More information about the Python-list
mailing list