PROLOG - DCG parsing
- by user2895589
Hello I am new Prolog and DGC.I want to write a DCG to parse time expressions like 10.20 am or 12 oclock. how can I check 10.20 am is valid expression or not for Olcock I wrote some code.
oclock --> digit1,phrase1.
digit1 --> [T],{digit1(T)}.
digit1(1).
digit1(2).
digit1(3).
digit1(4).
digit1(5).
digit1(6).
digit1(7).
digit1(8).
digit1(9).
digit1(10).
digit1(11).
digit1(12).
phrase1 --> [P],{phrase1(P)}.
phrase1(Oclock).
i ma checking by query
oclock([1,oclock],[]).
can someone help me on this.