4 Api

There is a little framework in guile-log imported with (logic guile-log) that enables the setup of syntactic sugar for streams. The api is

SCM: (define-guile-log-parser-tool (lam (X ...)) def oo xx cc)

lam will be the name of the new lambda object that can be used to produce a matcher. X ... will be the name of the syntax parameters and also define the standard positions for them in call and return. def is the corresponding define. To do an actual match in guile-log one need to use oo and when we issue a whole new expression we use xx. To return values from the matcher we use cc.

5 Example

The parsing framwork is using

(define-guile-log-parser-tool (<p-lambda> (X XL N M)) <p-define> .. xx <p-cc>)

An example to use xx is,

(<p-define> (f c1)
  (xx (c2) (<or> (.. (g c1)) (.. (h c1))))
  (<p-cc> `(g-or-h ,c2)))

in practice one keeps the numbers of needed uses of all of the above framework by using funcitonal combinators of matchers. But it is practical to just use this framework to e.g. define a c-parser.