Have a look at "web-apg-api.html" & "web-apg-api.js" to see how it is used.
Click on "generate" to generate a grammar object from the SABNF grammar.
(Errors are not reported in detail.)
Then click the "parse" button to use the generated grammar object to parse the input string.
SABNF grammar:
SABNF input string:
output: