source: project/release/4/genturfahi/trunk/chicken-ext.scm @ 22102

Last change on this file since 22102 was 22102, checked in by Alan Post, 10 years ago

genturfa'i: add debug and profile support to parser.

This is a fairly substantial patch, adding all of the framework to
produce debug output and profiling information from the parser.
When these options are not enabled, there is a small initialization
penalty and no runtime penalty to the parser.

When debug in enabled, a file is written containing a symbolic
expression describing the path taken by the parser while it matches
the input.

When profile is enabled, timing for non-terminal rules and operators
is written as an association list. This information isn't perfect
yet, as it doesn't subtract containing rules from the timing of
outer rules. For purposes of debugging performance, however, it is
good enough. It allowed me to find some performance issues in the
memoization code, a patch for which is coming up.

File size: 5.0 KB
Line 
1;;;;
2;;;; genturfahi - lo la .ckim. ke pe'a jajgau ratcu ke'e genturfa'i
3;;;;            `-> A Scheme packrat parser.
4;;;;
5;;;; Copyright (c) 2010 ".alyn.post." <alyn.post@lodockikumazvati.org>
6;;;;
7;;;; Permission to use, copy, modify, and/or distribute this software for any
8;;;; purpose with or without fee is hereby granted, provided that the above
9;;;; copyright notice and this permission notice appear in all copies.
10;;;;
11;;;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12;;;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13;;;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14;;;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15;;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16;;;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17;;;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18;;;;
19
20(module genturfahi
21  (genturfahi
22   genturfahi*
23
24   genturfahi-version
25   genturfahi-version-major
26   genturfahi-version-minor
27   genturfahi-version-patch
28
29   ; lerfu-porsi
30   ;
31   make-lerfu-porsi
32   make-lerfu-porsi-string
33   make-lerfu-porsi-port
34   make-lerfu-porsi-pabalvi-lerfu
35   make-lerfu-porsi-pabalvi-valsi
36   lerfu-porsi?
37   lerfu-porsi-zva
38   lerfu-porsi-poi
39   lerfu-porsi-string
40
41   lerfu-porsi->string
42
43   lerfu-porsi-lerfu
44   lerfu-porsi-fanmo?
45
46
47   ; javni-valsi
48   ;
49   make-javni-valsi
50   javni-valsi?
51   javni-valsi-cme
52   javni-valsi-val
53
54   javni-nastura?
55
56   javni-nunvalsi-val
57   javni-rodavalsi-val
58
59   ; a version that removes the predicate *-val, for use
60   ; when returning to code outside of genturfa'i.
61   ;
62   javni-nunvalsi-val-filter
63   javni-rodavalsi-val-filter
64
65   javni-valsi->string
66
67
68   ; nunvalsi
69   ;
70   make-nunvalsi
71   venunjmina-nunvalsi
72   vejmina-nunvalsi
73   vejmina-rodanunvalsi
74   vejmina-rodanunvalsi-nacmene
75
76   ; nunjavni
77   ;
78   nunjavni-lerfu
79   nunjavni-.
80   nunjavni-e
81   nunjavni-nil
82   nunjavni-fanmo
83   nunjavni-valsi
84   nunjavni-char-set-*
85   nunjavni-char-set-+
86   nunjavni-char-set
87   nunjavni-*
88   nunjavni-+
89   nunjavni-?
90   nunjavni-&
91   nunjavni-!
92   nunjavni-je
93   nunjavni-jonai
94
95   genturfahi-semorji
96   genturfahi-tolmohi
97   nunjavni-morji
98   nunjavni-samselpla
99   nunjavni-samselpla-cabna
100   nunjavni-cmene
101   nunjavni-nastura
102
103   nunjavni-secuxna
104
105   ; morji
106   ;
107   tolmohi-nunjavni
108   nunmorji-nunjavni
109
110   morji-nunjavni-lerfu
111   morji-nunjavni-.
112   morji-nunjavni-e
113   morji-nunjavni-nil
114   morji-nunjavni-fanmo
115   morji-nunjavni-valsi
116   morji-nunjavni-char-set-*
117   morji-nunjavni-char-set-+
118   morji-nunjavni-char-set
119   morji-nunjavni-*
120   morji-nunjavni-+
121   morji-nunjavni-?
122   morji-nunjavni-&
123   morji-nunjavni-!
124   morji-nunjavni-je
125   morji-nunjavni-jonai
126
127   morji-nunjavni-samselpla
128   morji-nunjavni-samselpla-cabna
129   morji-nunjavni-cmene
130   morji-nunjavni-nastura
131
132
133   ; nunvalsi
134   ;
135   venunjmina-nunvalsi
136   vejmina-nunvalsi
137   vejmina-nunvalsi-nacmene
138
139   venunjmina-rodanunvalsi
140   vejmina-rodanunvalsi
141   vejmina-rodanunvalsi-nacmene
142
143
144   ; cfiselsisku
145   cfisisku-datni
146   nunjavni-cfisisku
147
148   ; junla
149   junla-datni
150   nunjavni-junla
151
152
153   ; secuxna
154   secuxna-start-production
155   secuxna-define-name
156   secuxna-define-toplevel
157   secuxna-exit-status
158   secuxna-debug-file
159   secuxna-profile-file
160   secuxna-debug
161   secuxna-profile
162   secuxna-no-memoize
163   secuxna-sentinel
164   secuxna-empty-string
165   secuxna-empty-list
166   secuxna-nonmatch-token
167   secuxna-nastura)
168
169(import chicken)
170(import scheme)
171
172(include "chicken-declare.scm")
173
174;(require-extension utf8)
175
176(require-extension srfi-1)
177;(require-extension srfi-6)         ; built-in
178;(require-extension srfi-9)         ; built-in
179(require-extension srfi-13)
180(require-extension srfi-14)
181(require-extension srfi-18)
182;(require-extension srfi-28)        ; built-in
183;(require-extension srfi-39)        ; built-in
184;(require-extension srfi-61)        ; built-in
185(require-extension srfi-69)
186;(require-extension srfi-95)
187(require-extension data-structures)
188(require-extension extras)
189(require-extension latch)
190(require-extension ports)
191
192(import srfi-1)          ; filter
193;(import srfi-6)          ; string ports
194;(import srfi-9)          ; define-record-type
195(import srfi-13)         ; string-copy
196(import srfi-14)         ; character set library
197(import srfi-18)         ; multi-threading support
198;(import srfi-28)         ; basic format strings
199;(import srfi-39)         ; parameter objects
200;(import srfi-61)         ; A more general cond clause
201(import srfi-69)         ; basic hash tables
202;(import srfi-95)         ; sorting and merging
203(import data-structures) ; should be srfi-95
204(import extras)          ; format, pretty-print
205(import latch)           ; let-once
206(import ports)           ; Chicken Scheme srfi-6 and port extensions
207
208(include "chicken-platform.scm")
209
210(include "lerfu-porsi.scm")
211(include "javni-valsi.scm")
212(include "secuxna.scm")
213(include "nunjavni.scm")
214(include "morji.scm")
215(include "nunvalsi.scm")
216(include "cfisisku.scm")
217(include "junla.scm")
218(include "genturfahi.scm")
219(include "version.scm"))
Note: See TracBrowser for help on using the repository browser.