I\'m writing a Lisp to C translator and I have a problem with handling strings. This is a code that transforms an unary Lisp function to a C equivalent:
I am trying to build a DCG which recognizes all lists which match this form : a^n b^2m c^2m d^n开发者_Python百科.
I\'m trying to convert from this notation: A and (B or C) equ A and B or A and C) to standard logical notation i.e. things like and(A,B), or(A,B), neg(A)...
I\'m writing a Lisp-to-C translator using Prolog\'s built-in DCG capabilities. This is how I handle arithmetic:
So i got this for powerset: powerset([], []). powerset([H|T], P) :- powerset(T,P). powerset([H|T], [H|P]) :- powerset(T,P).
This may sound strange, but it is used in a parser, I want to be able to parse something of the form foo[bar]
okay, so I am using prolog to build a simple xml parser. And I have the following xml file: <ip> <line> 7 </line> <envt> p1:1 in main:1 </envt> </ip>
Currently I am playing with DCG in Prolog to parse an XML file. I was able to get the following code snippet which is able to parse a simple XML such as:
I am trying my hands on SWI-Prolog in win xp. I am trying to understand how to split a sentence in Prolog into separate atoms.
I am trying to make a predicate in order to validate if a given input represents a formula. I am allowed to use only to propositional atoms like p, q, r, s, t, etc.