Re:Learning Parser Combinators with Rust
by YeGoblynQueenne on Monday April 22, 2019 @01:12PM
(#19720639)
The wikipedia article has a few examples. For instance:
And here are some example queries:
To prevent any confusion - the "A --> B" syntax is syntactic sugar. Such statements are expanded to ordinary Prolog terms by the Prolog equivalent of a macro (an expansion hook). You can inspect the ordinary Prolog definitions saved in the program database:
Indeed, it's perfectly possible to write these by hand - as you can see above the ordinary Prolog definition is not that complicated, the macro expanding the DCG notation adds two variables to each nonterminal and relieves you of the need to add this boilerplate yourself.
[ Parent
| on HN ]
There are no comments on this comment yet.