Chapter 30. Newline Separators

Use newlines as statement separators.

first statementsecond statementthird statement

30.1 How It Works

Using newlines to mark the end of a statement is a common feature of programming languages. This fits very well with Delimiter-Directed Translation since newlines are used as the main delimiter to break up the input. As a result I have nothing to add here for that context.

With Syntax-Directed Translation, however, newline separators are rather more tricky, introducing a number of subtle traps that can trip you up. This section will hopefully point out of few of those traps.

(Of course it’s possible to use newlines for a syntactic purpose other than statement separation—but I’ve yet to come across it.)

The reason ...

Get Domain Specific Languages now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.