New! Render PlantUML diagrams directly inside GitHub
with our official browser extension —
No server. No tokens. No tracking. Zero permissions but clipboard. —
Try it out and let us know what you think!
语法图
Extended Backus-Naur Form (EBNF)是一种形式化的语法,用于指定编程语言或其他形式化语言的结构。它是Backus-Naur形式(BNF)的扩展,最初由John Backus和Peter Naur开发,用于描述Algol编程语言的语法。 EBNF在原来的BNF元符号的基础上增加了几个额外的元符号,这使得语言的语法规范更加简洁和易读。它常用于编程语言的规范,有时也用于描述其他类型的形式语言的语法,如数据库查询语言或标记语言。 在PlantUML中已经引入了对EBNF的基本支持。 *[Ref. [QA-16529](https://forum.plantuml.net/16529/could-we-add-syntax-diagrams)]*WARNING
This translation need to be updated. WARNING
Minimal binary diagram
All EBNF Elements
EBNF elements handled by PlantUML are described below.
Special sequence management with special-sequence-symbol "?"
You can manage special sequence with special-sequence-symbol "?".
Full repetition management with repetition-symbol "*"
You can manage repetition with repetition-symbol "*".
Drawing mode
Before version V1.2025.1, you can choice the drawing mode, and having a compacted mode by using !pragma compact command.
Expanded mode (by default, and the only one from V1.2025.1)
Compacted mode (only available before V1.2025.1)
Notes on Elements
Notes may be added to elements of your diagram by using EBNF comment tags.
Using (global) style
Without style (by default)
With style
You can use style to change rendering of elements.
Example of LISP Grammar
LISP Grammar with PlantUML.
EBNF of PlantUMLs EBNF Grammar
EBNF allows for self description, so here it is!
Java Language Specification
A real world example of a detailed programming language.
Packages and Modules
Lexical Structure
Types, Values, and Variables
Names
Classes
Interfaces
Arrays
Blocks, Statements, and Patterns
Remaining defects
Could you put 'arrow head' on all rerouted lines?
Order issue
Allow accentuated or Unicode char on EBNF meta-identifier or rule name.
Allow full restriction management with except-symbol "-"