Hi Doug,

> Might be something to consider adding to pilog.l Seems to be fairly
> standard in prologs - and useful for creating parsers :-)

OK, so let's see how it works out. Should perhaps be put into the
add-ons.


To make such rule declarations easier in the future, I've added a new
'clause' function, an evaluating equivalent of 'be'. It is available in
version 3.0.7.4 (current testing release), and also in Mini and Ersatz.

With that, the definition of 'dcg' can be slightly simplified:

   (de dcg CL
      (clause
         (if (pair (cadr CL))
            (list
               (car CL)
               (list (cons (caadr CL) '"@A") '"@A") )
            (cons
               (car CL)
               '("@In" "@Out")
               (let Vars
                  (make
                     (link "@In")
                     (for (I . @) (cddr CL)
                        (link (pack "@" I)) )
                     (link "@Out") )
                  (mapcar list
                     (cdr CL)
                     Vars
                     (cdr Vars) ) ) ) ) ) )

'be' makes use of it:

   (de be CL
      (clause CL) )

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to