Example of LaTeX parser:
use Regexp::Grammars; $parser = qr{ <File> <rule: File> <[Element]>* <rule: Element> <Command> | <Literal> <rule: Command> \\ <Literal> <Options>? <Args>? <rule: Options> \[ <[Option]>+ % (,) \] <rule: Args> \{ <[Element]>* \} <rule: Option> [^][\$&%#_{}~^\s,]+ <rule: Literal> [^][\$&%#_{}~^\s]+ }xms
Example of LaTeX parser:
[0] http://search.cpan.org/~dconway/Regexp-Grammars-1.041/lib/Re...