diff options
-rw-r--r-- | example.pl | 11 | ||||
-rw-r--r-- | parser.c | 6 |
2 files changed, 15 insertions, 2 deletions
@@ -2,4 +2,13 @@ math(A,B,C,D) :- D is A + B + C * A. -true.
\ No newline at end of file +true. + +likes(bob, ice). +likes(sam, text). +likes(sam, ice). + +could_be_friends(Person1, Person2) :- + likes(Person1, Thing1), + likes(Person2, Thing2), + Thing1 = Thing2.
\ No newline at end of file @@ -158,6 +158,10 @@ term(void) result = mknumber(NumberFloat, 0, lookahead.dval); match(FloatTok); break; + case CommaTok: + result = mkatom(L","); + match(CommaTok); + break; default: print("Cant parse term of token type %d\n", lookahead.tag); syntaxerror("term"); @@ -219,7 +223,7 @@ parseoperators(Term *list) for(i = 0; i < length; i++){ if(infos[i].type == 0) continue; - if(infos[i].level == lowest && infos[i].type == Xfy && i == index+1) + if(infos[i].level == lowest && infos[i].type == Xfy) index = i; else if(infos[i].level < lowest){ index = i; |