Core PDML Grammar
The following table illustrates PDML's grammar, expressed in an EBNF-like notation.
Only Core PDML is covered. Optional extensions like attributes, namespaces etc. are not included.
The following grammar is not a specification. It is just an auxiliary asset to contextualize the official specification.
The grammar is also illustrated as Railroad Diagrams.
Name | Rule | Examples | |
---|---|---|---|
node | = | empty_node | non_empty_node |
|
empty_node | = | "[" name "]" | [new_line] |
non_empty_node | = | "[" name separator child_node + "]" Note: The separator is optional if the name is immediately followed by [. |
[color orange] [config [color orange]] [div A [i[b nice]] dog] |
name | = | name_start_char name_char * Regex: [a-zA-Z_][a-zA-Z0-9_\.-]* |
height ins-file _default Index_12-a.2 |
name_start_char | = | "a" .. "z" | "A" .. "Z" | "_" |
a Z _ |
name_char | = | "a" .. "z" | "A" .. "Z" | "0" .. "9" | "_" | "-" | "." |
a Z 9 _ - . |
separator | = | " " | "\t" | "\n" | "\r\n" |
|
child_node | = | node | text |
[b [i huge]] [message All is well!] |
text | = | text_char + | Bob 3.14 We want simplicity. root\\config\["port"\] |
text_char | = | any Unicode character, except "[", "]", and "\" | "\[" | "\]" | "\\" |
a 😀 \[ |