# GRAMMAR_NAME-grammar

#######################################################################
#
#  EBNF-Directives
#
#######################################################################

# Regular expression for implicit whitespace or one of: horizontal, linefeed, vertical
# Implicit whitespace is denoted by the tilde-character: ~
@ whitespace  = linefeed

# Implicit whitespace adjacent to literals: left, right, both, none
# E.g. if @literalws = right then ")" means the same as `)`~
@ literalws   = right

# Regular expression for comments, e.g. /#.*(?:\n|$)/
# Use: /(?:\/\/.*)|(?:\/\*(?:.|\n)*?\*\/)/ for C++-style comments: /* ... */ or // to EOL
@ comment     = /#.*/

# Case-sensitivity: True, False
@ ignorecase  = False

# Tree-simplification while parsing:  none, flatten, merge_treetops, merge
@ reduction   = flatten         # anonymous nodes are being reduced where possible

# Tags that may be replaced with their content while parsing
@ disposable  = EOF

# Tags that will be dropped with all their content while parsing
# Here, EOF and insignificant whitespace (tilde) will be dropped
@ drop        = EOF, whitespace


#######################################################################
#
#:  Structure and Components
#
#######################################################################

document = ~ { WORD } §EOF      # root parser: a sequence of words preceded
                                # by whitespace until the end of file

#######################################################################
#
#:  Regular Expressions
#
#######################################################################

WORD     =  /\w+/~      # a sequence of letters, optional trailing whitespace
EOF      =  !/./        # no more characters ahead, end of file reached
