I would like to propose introducing a PHP target and runtime.
Is anyone interested in joining me to implement a PHP target?
<!DOCTYPE html><?xml-stylesheet href="antlr.css" ?><?php
$text = <<<ANTLR
grammar Calculator;
NUMBER: [0-9]+;
WS : [ \\t\\r\\n]+ -> skip ; // notice the antislash in hereDoc
expr
: sum=(a=expr '+' b=expr)
| sub=(a=expr '-' b=expr)
| mul=(a=expr '*' b=expr)
| div=(a=expr '/' b=expr)
| fac=('(' a=expr ')')
| num=(a=NUMBER)
;
ANTLR;
$doc = new ANTLRDocument();
// By default the ANTLRDocument use the antlr4 grammar. Use
ANTLRImplementation to select parser
$doc->load($text);
$xml = $doc
->saveHTML();// $doc->saveJAVA(); ... $doc->saveCPP();
// output expected :