[sc34wg3] Making semicolons and newlines equivalent?
Lars Marius Garshol
larsga at garshol.priv.no
Thu Jan 31 04:44:26 EST 2008
* Xuân Baldauf
>
> When searching for a formal language which is very successful in a
> non-European culture, we can easily find Ruby. As CTM is necessarily
> a formal language, we may be able to copy some syntax-features from
> Ruby. One of them is the equivalence of semicolons and newlines.
Actually, Python has this, too. You can put multiple statements on a
single line by separating them with ";". I this actually started with
BASIC, which used ":", if I remember correctly.
> Some formal languages have peculiarities due to semicolon-newline-
> equivalence, an example fromhttp://docs.codehaus.org/display/GroovyJSR/Optional+semicolon
> :
> y = a + b
> Here, the parser sees that, due to the '+', the second operand ("b")
> is missing. Thus, it does not treat the newline after "y = a +" as
> end-of-statement.
I don't think this problem arises in CTM, given that the semicolons
are superfluous to begin with. So putting a simple
statement ::= (name | occurrence | ...) ";"?
into the grammar would probably suffice.
I don't think I like this proposal, but I don't think I hate it,
either. It's worth chewing over.
--Lars M.
More information about the sc34wg3
mailing list