---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 23 Edition"
java_version: 23
chapter: "Chapter 2. Grammars"
section: "2"
heading: "Chapter 2. Grammars"
source: https://docs.oracle.com/javase/specs/jls/se23/html/jls-2.html
id: "2"
url: https://jvm.obfuscated.software/jls/se23/2.html
raw: https://jvm.obfuscated.software/jls/se23/2.md
---

# Chapter 2. Grammars

This chapter describes the context-free grammars used in this specification to define the lexical and syntactic structure of a program.

**Sections:**

- [2.1. Context-Free Grammars](2.1.md)
- [2.2. The Lexical Grammar](2.2.md)
- [2.3. The Syntactic Grammar](2.3.md)
- [2.4. Grammar Notation](2.4.md)
