Skip to content

Grammar

This is the grammar I've created for a markdown variant.

document: entry*

entry: _begin title text _end
title: "#" string
_begin: "<!--BEGIN" (attribute)* "-->" 
_end: "<!--END-->"
attribute: identifier "=" value
value: escaped_string
      |integer
text: string*
identifier: /[A-Za-z_]+/ 

integer: /\d+/
string: /.+/
escaped_string: ESCAPED_STRING 

%import common.ESCAPED_STRING
%import common.WS
%ignore WS