An action is a quotation that is run after a rule matches. The quotation consumes the AST of the rule match and leaves a new AST as the result. The stack effect of the action can be ( ast -- ast ) or ( -- ast ). If it is the latter then the original AST is implicitly dropped and will be replaced by the AST left on the stack. This is mostly useful if variables are used in the rule since they can be referenced like locals in the action quotation. The action is defined by having a ' => ' at the end of a rule and using '[[' and ']]' to open and close the quotation. If an action leaves the object 'ignore' on the stack then the result of that action will not be put in the AST of the result.

Examples
USING: prettyprint peg.ebnf strings ; "<abcd>" EBNF[=[ rule="<" ((!(">") .)* => [[ >string ]]) ">" ]=] .
V{ "<" "abcd" ">" }

USING: prettyprint peg.ebnf math.parser ; "123" EBNF[=[ rule=[0-9]+ => [[ string>number ]] ]=] .
123