/* File: gram3.pl Author: Mihaela Malita Title: Grammar for L(G)= a^n b^n Look in a file ?- start. In what file is your grammar? 'C://Mihaela/Prologmm/exgram0.pl'. Grammar is for a^n b^n Input a word: aabb. Generated Continue(y/n)?= y. Grammar for a^n b^n Input a word as a list: aab. Not generated Continue(y/n)?= n. File: exgram0.pl contains write_grammar:- write('Grammar is for a^n b^n '), nl. s --> [a],[b]. s --> [a],s,[b]. */ start:- write('In what file is your grammar? '),read(F),consult(F), write_grammar, write('Input a word: '),read(A),atom_chars(A,L), (phrase(s,L) -> write('Generated') ; write('Not generated')), nl,yesorno,start. yesorno:- write('Continue(y/n)?= '),read(R),R=y.