O'Reilly logo

Java™ Language Specification, Third Edition, The by Gilad Bracha, Guy Steele, Bill Joy, James Gosling

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

 

Is there grammar in a title. There is grammar in a title. Thank you.

 
 --Gertrude Stein, Arthur a Grammar, in How to Write (1931)

This chapter presents a grammar for the Java programming language.

The grammar presented piecemeal in the preceding chapters is much better for exposition, but it is not well suited as a basis for a parser. The grammar presented in this chapter is the basis for the reference implementation. Note that it is not an LL(1) grammar, though in many cases it minimizes the necessary look ahead.

The grammar below uses the following BNF-style conventions:

  • [x] denotes zero or one occurrences of x.

  • {x} denotes zero or more occurrences of x.

    x | y means one of either x or y.

The Grammar of the Java Programming Language ...

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