phil_algs / Languages /docs7.txt
luciangreen's picture
Upload 1424 files
557a17a verified
# Grammars
* List Prolog supports grammars, for example:
* Grammars may be recursive (see test 9 in <a href="https://github.com/luciangreen/listprologinterpreter/blob/master/lpiverify4.pl">lpiverify4.pl</a>), i.e. they may repeat until triggering the base case:
test(9,`[[n,grammar1],["aaa"]]`,
[
`[[n,grammar1],[[v,s]],":-",[[[n,noun],[[v,s],""]]]]`,
`[[n,noun],"->",[""]]`,
`[[n,noun],"->",["a",[[n,noun]]]]`
],
`[[]]`).