|Indenting vs begin/end firstname.lastname@example.org (1995-07-06)|
|Re: Indenting vs begin/end email@example.com (Ronald F. Guilmette) (1995-07-11)|
|Re: Indenting vs begin/end firstname.lastname@example.org (Jens Peter Secher) (1995-07-12)|
|Re: Indenting vs begin/end email@example.com (Charles Fiterman) (1995-07-17)|
|Re: Indenting vs begin/end firstname.lastname@example.org (1995-07-14)|
|From:||email@example.com (Itai Nahshon)|
|Organization:||IBM Israel Science and Technology, Haifa, Israel|
|Date:||Fri, 14 Jul 1995 18:59:20 GMT|
firstname.lastname@example.org (M.M._van_der_Laan) writes:
>I am designing a language where end-of-line means end-of-statement
>and where indenting is used instead of begin-end. While this saves
>a lot of typing and prevents the programmer from errors, there are
>a lot of people against it (see 'the semicolon habit' and other
>articles). I can think of two extensions to the language to
>overcome their problems:
As a student's project I have one implemented a preprocessor for
OCCAM. If I recall it right, OCAAM uses indentation as structure
directive and EOL and a statement terminator.
Surprisingly, implementation using lex and yacc was easy. Lex
emitted BEGIN and END tokens when it has seen a change in the
indentation, and a EOL token on end of line. It auto-compensated for
different indentation styles (It still had to know what's the
tab-stop used in your editor). I had to keep a stack of indentation
levels because lex had to generate more than one END statement when
leaving a nested compound statement.
It also knew about continuation lines when a statement did not finish
in one line (for example, when the last token seen before the end of
line is a binary operator).
Well, Writing a parser for that language is one thing. Using it is
another. Personally I like the "semicolon style" languages better.
Return to the
Search the comp.compilers archives again.