Top-Down parsing with backtracking

This page implements in javascript a simple top-down parsing algorithm with backtracking. Enter the desired grammar together with a list of tokens to parse (separated with spaces). Press the "init" button to initialize the parser. The "step" buttons then run various number of steps of the algorithm and prints the intermediate results. In each intermediate parsing tree, the green leaf is the current leaf.

Syntax for the grammar follows BNF standard. Use a semicolon to separate each rules. The root is taken as the first non-terminal symbol defined. Empty word is written with <>.

Click here to fill the text areas with an example.

Grammaire
Texte

Init 1 step 10 steps 100 steps

Result:

Init 1 Step 10 steps 100 steps


Valid XHTML 1.0 Strict. Application produite par BenoƮt Valiron @ 2015.