Skip to content

Instantly share code, notes, and snippets.

@Chubek
Last active July 13, 2025 17:25
Show Gist options
  • Save Chubek/c389cd72ca40207e3cb4f3926c8c5312 to your computer and use it in GitHub Desktop.
Save Chubek/c389cd72ca40207e3cb4f3926c8c5312 to your computer and use it in GitHub Desktop.
PLT grammar notation cheatsheet

Understanding Grammar Notations Used in PLT Textbooks ('Cheatsheet')

Chubak Bidpaa (Based on the 3rd edition of TDB, pages 198-199)

PLT textboks often use Greek and Latin letters to denote grammatic notations such as terminal, non-terminals, and other such concepts. For a beginner (like me!) it could be rather overwhelming. So I created this cheatsheet to be used as reference for any curious person or learners, alike.

Categories

Always Terminal

T1. Lowercase letters early in the alphabet (a, b, c, ...)

T2. Operators and symbols (+, *, /...)

T3. Punctuation symbols ( (, {, ,...)

T4. The digits (0..9)

T5. Boldface strings (if, id)


Always Nonterminal

NT1. Uppercase letters early in the alphabet (A, B, C, ...)

NT2. Start symbols is always an uppercase S. If we prime the S symbol, i.e. S'. it means 'Constructed Start Symbol'.

NT3. Lower, italic names, e.g. expr and stmt

NT4. Uppercase letters such as E, T, and F reckon back to constructs (Expression, Term, Factor)


Either Terminal, Nonterminal or Production

TNT1. Uppercase letters late in the alphabet (X, Y, Z)

TNT2. Lowercase letters late in the alphabet denote strings of terminals (x, y, z)

TNT3. Lowercase Greek letters denote (possibly empty) strings of grammar symbols (α, β, ζ)

TNT4. A -> ζ (or any letter of TNT3) denotes a production

TNT5. Likewise, A -> ζ₀ | ζ₁ | ζ₂ ... denotes a production with alternatives

TNT6. Likewise, X -> X₀ X₁ X₂ ... denotes a production with its symbols (term/nterm)

TNT6. Likewise, A -> α B β denotes a production with prefix of α, non-terminal of B and postfix of β.

Good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment