<div class="notebook open-fullscreen"> <div class="nb-cell program" name="p1"> % Auszug aus experiment1.pl % % adapted by Wiebke Petersen </div> <div class="nb-cell markdown" name="md2"> ## Task 1: Specify a reasonable syntax for the language fragment </div> <div class="nb-cell markdown" name="md3"> We will use Prolog DCGs: </div> <div class="nb-cell program" name="p3"> % toy grammar s --> np,vp. np --> det,n. np --> pn. vp --> v,np. det --> [ein]. pn --> [pia]. pn --> [paul]. pn --> [maria]. n --> [kind]. v --> [liebt]. </div> <div class="nb-cell query" name="q2"> s([pia,liebt,maria],[]). </div> <div class="nb-cell query" name="q3"> s(S,[]). </div> <div class="nb-cell markdown" name="md1"> **Exercise** (1) How many sentences are accepted by this grammar? How many noun phrases? How many verb phrases? (2) Use the Prolog built-in predicate `findall/3` to generate the relevant items. (3) Use the predicate `length/2` to check the length of these generated lists. </div> <div class="nb-cell query" name="q1"> </div> </div>