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

Last change on this file since 21950 was 21950, checked in by Alan Post, 9 years ago

genturfa'i: add -| operator for immediate code execution.

This is used to execute the header code in genturfahi.peg before
parsing the rest of the grammar.

Because of the rules of scheme and the implementation of of
genturfa'i, I can't guarantee that the parse tree is executed in any
particular order, save that the leaves will be executed before their
branches.

Even if I change genturfa'i to guarantee a certain kind of order, I
can't change the Scheme standard, which does not requires parameters
to a function to be evaluated in any particular order.

This change executes the code during the parse. It may execute
multiple times, though with memoization turned on this should not be
true. Regardless, I don't really specify the number of times this
code is executed, and have limited my operations to those that can
be executed multiple times with no side-effects.

File size: 2.8 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-peg
21  (genturfahi-env
22
23   genturfahi-peg
24   genturfahi-peg-gerna
25
26   ; samselpla
27   samselpla-hash-table
28   samselpla-hash-table*
29
30   samselpla-cmene->symbol
31   samselpla-cmene->symbol*
32
33   samselpla-smuni
34   samselpla-naselci
35   samselpla-je
36   samselpla-nastura-javni
37   samselpla-pajavni-cmene
38   samselpla-jonai
39   samselpla-?
40   samselpla-*
41   samselpla-+
42   samselpla-&
43   samselpla-fanmo
44   samselpla-!
45   samselpla-cmene-sumti
46   samselpla-selci-naselci
47   samselpla-stura-lerfu-selci
48   samselpla-lerfu-selci
49   samselpla-lerfu-space
50   samselpla-lerfu-return
51   samselpla-lerfu-linefeed
52   samselpla-lerfu-newline
53   samselpla-lerfu-return
54   samselpla-lerfu-tab
55   samselpla-stura-valsi-selci
56   samselpla-valsi-selci
57   samselpla-valsi-newline
58   samselpla-valsi-linefeed
59   samselpla-valsi-tab
60   samselpla-valsi-backslash
61   samselpla-valsi-single-quote
62   samselpla-valsi-double-quote
63   samselpla-valsi-lerfu
64   samselpla-klesi-selci
65   samselpla-denpabu
66   samselpla-samselpla-xadni
67   samselpla-samselpla-cmene
68   samselpla-samselpla-balvi
69   samselpla-samselpla-cabna
70   samselpla-stura-empty-string
71   samselpla-empty-string
72   samselpla-empty-list)
73
74(import chicken)
75(import scheme)
76
77(include "chicken-declare.scm")
78
79;(require-extension utf8)
80
81(require-extension srfi-1)
82(require-extension srfi-13)
83(require-extension srfi-14)
84(require-extension srfi-69)
85(require-extension ports)
86(require-library sandbox)
87(require-library genturfahi)
88
89(import srfi-1)          ; unzip2
90(import srfi-13)         ; string-append, string-copy
91(import srfi-14)         ; character set library
92(import srfi-69)         ; basic hash tables
93(import ports)           ; Chicken Scheme srfi-6 and port extensions
94(import sandbox)
95(import genturfahi)
96
97(include "eval.scm")
98(include "samselpla.scm")
99(include "bootstrap.scm")
100(include "peg.scm"))
Note: See TracBrowser for help on using the repository browser.