Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Puppet EBNF (kind of)
# Try with: http://www.bottlecaps.de/rr/ui
ACTOR ::= 'actor' ( '(' PARAMS ')')? ('inherits' NAME)?
'{'
(QUEUE | INBOX | ACTION | SEQUENCE | PARALLEL | FUNCTION | STATE | CONSTANT | LOCAL_TYPE)*
'}'
SEQUENCE ::= 'sequence' '{' (ACTION | SEQUENCE | PARALLEL)* '}'
PARALLEL ::= 'parallel' '{' (ACTION | SEQUENCE | PARALLEL)* '}'
ACTION ::= 'action' NAME ('{' INPUT* OUTPUT* '}')?
INPUT ::= ('!!' ASSIGNMENTS? | ASSIGNMENTS ) '<-' (EXPRESSION | 'state') ('where' EXPRESSION)?
ASSIGNMENTS ::= VARIABLE | '_' | '[' ASSIGNMENTS (',' ASSIGNMENTS)* ','? ']' | '(' ASSIGNMENTS (',' ASSIGNMENTS)* ','? ')'
FUNCTION ::= 'function' '(' PARAMS ')' '{' EXPRESSION* '}'
STATE ::= WORD ( ',' WORD)*
QUEUE ::= VISIBILITY 'queue' TYPE NAME ('{' ( (
'capacity'
| 'ttl'
| 'entries'
| 'schedule'
| 'latched'
| 'replace'
)
'=>' EXPRESSION)* '}')?
INBOX ::= VISIBILITY 'queue' TYPE NAME ('{' ( (
'capacity'
| 'ttl'
| 'entries'
| 'schedule'
| 'latched'
| 'replace'
)
'=>' EXPRESSION)* '}')?
PARAMS ::= TYPE? '*'? VARIABLE ('=' EXPRESSION)? (',' TYPE? '*'? VARIABLE ('=' EXPRESSION)?)* ','?
CONSTANT ::= VARIABLE '=' EXPRESSION
LOCAL_TYPE ::= 'type' TYPE_NAME '=' TYPE_EXPRESSION
VARIABLE ::= '$' NAME
NAME ::= [a-z][a-z0-9A-Z]*
IGNORED ::= [_]
VISIBILITY ::= 'private' | 'protected' | 'public'
EXPRESSION ::= EXPRESSION ('+' | '-' | '*' | '/' | '%' | '.' | 'and' | 'or' | '==' | '!=' | '=~' | '!~' | '<' | '>' | '>=' | '<=' ) EXPRESSION
| EXPRESSION '[' EXPRESSION (',' EXPRESSION)* ','?']'
| '-' EXPRESSION
| '(' EXPRESSION ')'
| 'not' EXPRESSION
| 'if' EXPRESSION '{' EXPRESSIONS? '}' ELSE_IF* ELSE?
| 'unless' EXPRESSION '{' EXPRESSIONS? '}' ELSE?
| 'case' EXPRESSION '{' ((EXPRESSION (',' EXPRESSION)*) ':' '{' EXPRESSIONS? '}' )* '}'
| EXPRESSION '?' '{' (EXPRESSION '=>' EXPRESSION (',' EXPRESSION '=>' EXPRESSION)* ) '}'
| 'default' | 'undef'
| DQ_STRING | HEREDOC
| LITERAL
LITERAL ::= INTEGER | FLOAT | SQ_STRING | BOOLEAN | REGEXP
BOOLEAN ::= 'false' | 'true'
INTEGER ::= '0' [0-7]* | ('0x' | '0X') [0-9a-fA-F]* | [1-9][0-9]*
FLOAT ::= [0-9]+ '.' [0-9]+ (('e'|'E') ('+'|'-') [0-9]+)
SQ_STRING ::= ['] '<chars and escapes>' [']
DQ_STRING ::= ["] '<chars, escapes, and interpolation>' ["]
HEREDOC ::= '@(' '<heredoc-header-syntax>' ')'
REGEXP ::= '/' '<regexp-syntax>' '/'
EXPRESSIONS ::= EXPRESSION (';'? EXPRESSION)*
ELSIF ::= 'elsif' EXPRESSION '{' EXPRESSIONS? '}'
ELSE ::= 'else' '{' EXPRESSIONS? '}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.