O'Reilly logo

Domain Specific Languages by Martin Fowler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required