development
[software/python-on-guile.git] / modules / language / python / parser-tool.scm
1 (define-module (language python parser-tool)
2 #:use-module (ice-9 pretty-print)
3 #:use-module (logic guile-log parsing scanner)
4 #:use-module ((logic guile-log parser)
5 #:select (setup-parser
6 f-nl f-nl!
7 *current-file-parsing*
8 make-file-reader file-next-line file-skip))
9 #:use-module (logic guile-log)
10 #:re-export (f-nl f-nl!)
11 #:export (f-seq f-seq! f-or f-or! f-not f-not! f-true f-false f-cons f-cons*
12 f-list INDENT <p-lambda> f* ff* ff? f? ff+ f+
13 f-reg f-reg! f-tag f-tag! f-eof f-out f-and f-and!
14 mk-token p-freeze parse f-append
15 .. xx <p-cc>
16 f-pk))
17
18 ;; Preliminary
19 (define do-print #f)
20 (define pp
21 (case-lambda
22 ((s x)
23 (when do-print
24 (pretty-print `(,s ,(syntax->datum x))))
25 x)
26 ((x)
27 (when do-print
28 (pretty-print (syntax->datum x)))
29 x)))
30
31
32 (begin
33 (define-guile-log-parser-tool (<p-lambda> (X XL N M INDENT)) <p-define> ..
34 xx <p-cc>)
35
36
37 (make-guile-log-scanner-tools <p-lambda> <fail> <p-cc> <succeds> ..
38 (X XL N M INDENT)
39 (c) (d)
40 s-false s-true s-mk-seq s-mk-and s-mk-or)
41
42 ;; Sets up a standar parser functionals with INDENT field added
43 (setup-parser
44 <p-define> <p-lambda> <fail> <p-cc> <succeds> .. xx
45 X XL ((N 0) (M 0) (INDENT (list 0)))
46 s-false s-true s-mk-seq s-mk-and s-mk-or))