Implementation of predicates for DCG translation 
Author Message
 Implementation of predicates for DCG translation

Does anyone know where I can find an example of the implementation of
the predicates which manage the translation from a DCG program to a
standard Prolog program?

For example, SICStus Prolog passes from this:

e --> t, [+], e.
e --> t.
t --> a.

to this:

a(A, B) :- 'C'(A, a, B).
e(A, B) :- t(A, C), 'C'(C, +, D), e(D, B).
e(A, B) :- t(A, B).
t(A, B) :- 'C'(A, a, B).

using, as far as I understand, the following built-in predicates:

expand_term/2
term_expansion/[2,4]
goal_expansion/3
phrase/[2,3]
'C'/3

I am interested in how these predicates are implemented, but obviously
SICStus Prolog does not provide any source for its built-ins.

So, does anyone know where I can find information about the
implementation of this kind of predicates handling transformation from
DCG programs to standard Prolog programs?

TIA.

--
Giulio.



Fri, 06 Aug 2004 10:01:22 GMT  
 Implementation of predicates for DCG translation

Quote:

> Does anyone know where I can find an example of the implementation of
> the predicates which manage the translation from a DCG program to a
> standard Prolog program?

IIRC, Richard O'Keefe's _The Craft of Prolog_ contains some information
on DCG translation.

You might also look for the "Logical State Threads" package, which is an
extended version of DCGs.  See Peter van Roy's page at

        http://www.info.ucl.ac.be/people/PVR/implementation.html

HTH,
        Jens.
--

  http://www.bawue.de/~jjk/          fax:+49-7031-464-7351
PGP:       06 04 1C 35 7B DC 1F 26 As the air to a bird, or the sea to a fish,
0x555DA8B5 BB A2 F0 66 77 75 E1 08 so is contempt to the contemptible. [Blake]



Fri, 06 Aug 2004 16:42:26 GMT  
 Implementation of predicates for DCG translation

There's source code for the DCG translation available in the XSB
distribution, in $XSBDIR$/syslib/dcg.P

-David



Tue, 24 Aug 2004 07:01:31 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. DCG translation

2. DCG translation repost

3. translation of DCG's into Prolog in Sicstus2.1

4. translation to predicate calculus

5. Predicate dispatching implementation in Scheme?

6. freeze/2 predicate implementation description, references ?

7. Implementation of predicate-based coroutining

8. Predicates that create new predicates.

9. Animation help: Translation->Rotation->Translation

10. DCG troubles

11. DCG problem

12. DCG help ASAP!!!

 

 
Powered by phpBB® Forum Software