Arithmetic grammar railroad
PlantUML EBNF with recursive rule references and a note.
Scope: Static grammar diagram and structural exploration; parse evidence requires an external provider.
Preview
Source
ebnf-arithmetic.puml
text/plain
@startebnf
title Arithmetic with recursion
(* Expressions refer to terms; parentheses refer back to expressions. *)
expression = term, { ("+" | "-"), term };
term = factor, { ("*" | "/"), factor };
factor = number | "(", expression, ")" | "-", factor;
number = digit, { digit };
digit = ? any decimal digit ? - "0" | "0";
@endebnf