|
| 1 | +#define Xinclude #include |
| 2 | +Xinclude <stdlib.h> |
| 3 | +Xinclude <stdio.h> |
1 | 4 |
|
2 |
| - #define i int |
3 |
| - #define n struct n |
4 |
| - #define T , char **C) { return ( |
5 |
| - #define x ){ return ( |
6 |
| - #define A -> |
7 |
| - #define N n* |
| 5 | +#define l #define |
| 6 | +#define p(p) l p b ( m p u X ) |
| 7 | + |
| 8 | +l i int |
| 9 | +l n struct n |
| 10 | +l x ){ return ( |
| 11 | +l A -> |
| 12 | +l N n* |
8 | 13 |
|
9 | 14 | n { i c ; N L ; N R ; N U ; N ( * F ) ( N ) ; } ;
|
10 | 15 |
|
11 |
| - #define F A F |
12 |
| - #define U A U |
13 |
| - #define R A R |
14 |
| - #define L A L |
15 |
| - #define m q = malloc(sizeof * q ) Z F = |
16 |
| - #define e z F ( p ) ) ; } |
17 |
| - #define f e N |
18 |
| - #define g z L Q s f |
19 |
| - #define h ( N p x |
20 |
| - #define H h p L U Q |
21 |
| - #define s R z R = q |
22 |
| - #define t ) ? p : ( |
23 |
| - #define z , p |
24 |
| - #define Z , q |
25 |
| - #define Q = p |
26 |
| - #define w ! p U t p U L Q z Q U , |
27 |
| - #define D W p R U = 0 z R Q R F ( p R ) z R F != E t |
28 |
| - #define W h w |
29 |
| - #define X z = q , 0 |
30 |
| - #define V w p F = v z L Q |
31 |
| - #define O m o Z L Q |
32 |
| - #define M m E Z A c = |
33 |
| - #define r Z R Q |
34 |
| - #define u Z U Q |
35 |
| - #define a ) ) ) ? 0 : j ( ! |
36 |
| - #define k ( i c x |
37 |
| - #define y 0 ) ; } i |
| 16 | +l F A F |
| 17 | +l U A U |
| 18 | +l R A R |
| 19 | +l L A L |
| 20 | +l m q = malloc(sizeof * q ) Z F = |
| 21 | +l e z F ( p ) ) ; } |
| 22 | +l f e N |
| 23 | +l g z L Q s f |
| 24 | +l h ( N p x |
| 25 | +l H h p L U Q |
| 26 | +l s R z R = q |
| 27 | +l t ) ? p : ( |
| 28 | +l z , p |
| 29 | +l Z , q |
| 30 | +l Q = p |
| 31 | +l w ! p U t p U L Q z Q U , |
| 32 | +l D W p R U = 0 z R Q R F ( p R ) z R F != E t |
| 33 | +l W h w |
| 34 | +l X z = q , 0 |
| 35 | +l V w p F = v z L Q |
| 36 | +l O m o Z L Q |
| 37 | +l M m E Z A c = |
| 38 | +l r Z R Q |
| 39 | +l u Z U Q |
| 40 | +l a ) ) ) ? 0 : j ( ! |
| 41 | +l k ( i c x |
| 42 | +l y 0 ) ; } i |
38 | 43 |
|
39 | 44 | N q ; N
|
40 | 45 | o H z Q L f
|
41 | 46 | v H U z Q L f
|
42 | 47 | K W V L R f
|
43 | 48 | J W V R f
|
44 | 49 | I h V R f
|
45 |
| - |
46 |
| - |
47 |
| - |
| 50 | +#if 0 |
| 51 | +Y W q Q g |
| 52 | +#endif |
48 | 53 | S W w w O L L R r s , O L R r R R g
|
49 | 54 | E D p F Q L A c - p R A c ? J : K f
|
50 | 55 | P D w putchar ( p L R A c ) , m I g
|
|
53 | 58 |
|
54 | 59 | i j k c ? O U r u U U X : y b k y d k y
|
55 | 60 |
|
56 |
| - #define d(d) ( ( d a b |
57 |
| - #define b(b) ( ( b a d |
58 |
| - #define E(E) b ( M E u X ) |
59 |
| - |
60 |
| -main ( i c T |
61 |
| - |
62 |
| - #define I b ( m I u X ) |
63 |
| - #define J b ( m J u X ) |
64 |
| - #define K b ( m K u X ) |
65 |
| - |
66 |
| - |
| 61 | +l d(d) ( ( d a b |
| 62 | +l b(b) ( ( b a d |
| 63 | +l E(E) b ( M E u X ) |
67 | 64 |
|
68 |
| - #define P b ( m P u X ) |
69 |
| - #define G b ( m G u X ) |
| 65 | +main ( x i ) ! ( |
70 | 66 |
|
71 |
| - #define S b ( m S u X ) |
72 |
| - #define B b (S (K S) K) |
73 |
| - #define SS b (B (B S) B) |
74 |
| - #define C b (SS B S (K K)) |
75 |
| - #define CC b (B (B C) B) |
76 |
| - #define BB b (CC B (B B B) B) |
| 67 | +p (I) |
| 68 | +p (J) |
| 69 | +p (K) |
| 70 | +#if 0 |
| 71 | +p (Y) |
| 72 | +#endif |
| 73 | +p (P) |
| 74 | +p (G) |
77 | 75 |
|
78 |
| - #define Y b (S (C B (S I I)) (C B (S I I))) |
| 76 | +p (S) |
| 77 | +l B b (S (K S) K) |
| 78 | +l SS b (B (B S) B) |
| 79 | +l C b (SS B S (K K)) |
| 80 | +l CC b (B (B C) B) |
| 81 | +l BB b (CC B (B B B) B) |
79 | 82 |
|
80 |
| - #define CI b (C I) |
| 83 | +l Y b (S (C B (S I I)) (C B (S I I))) |
81 | 84 |
|
82 |
| - #define ef E((-1)) |
83 |
| - #define sp E(' ') |
84 |
| - #define ob E('(') |
85 |
| - #define cb E(')') |
86 |
| - #define lm E('\\') |
87 |
| - #define nl E('\n') |
88 |
| - #define ht E('\t') |
89 |
| - #define qs E('S') |
90 |
| - #define qk E('K') |
91 |
| - #define qi E('I') |
| 85 | +l CI b (C I) |
92 | 86 |
|
93 |
| - #define pair b (BB (B (B K)) C CI) |
94 |
| - #define atom b (B K CI) |
| 87 | +l ef E(EOF) |
| 88 | +l sp E(' ') |
| 89 | +l ob E('(') |
| 90 | +l cb E(')') |
| 91 | +l lm E('\\') |
| 92 | +l nl E('\n') |
| 93 | +l ht E('\t') |
| 94 | +l qs E('S') |
| 95 | +l qk E('K') |
| 96 | +l qi E('I') |
95 | 97 |
|
96 |
| - #define bind b (CC B B C) |
| 98 | +l pair b (BB (B (B K)) C CI) |
| 99 | +l atom b (B K CI) |
97 | 100 |
|
98 |
| - #define ore b (SS (CI K)) |
99 |
| - #define gns b (Y (B (bind G) (CC S (C (ore sp (ore nl ht))) CI))) |
| 101 | +l bind b (CC B B C) |
100 | 102 |
|
101 |
| - #define pr b (Y (CC C (BB CI (B (BB (bind (P ob)) K)) (SS C (CC C (BB BB bind) K) (C (CC bind) (K (P cb))))) P)) |
| 103 | +l ore b (SS (CI K)) |
| 104 | +l gns b (Y (B (bind G) (CC S (C (ore sp (ore nl ht))) CI))) |
102 | 105 |
|
103 |
| - #define trans b (Y (B (bind gns) (S (BB S (C lm) lam) (C (BB S (C ob) brac) (S (C cb (CI (atom sp))) (S (C ef (CI (atom sp))) (B CI atom))))))) |
| 106 | +l pr b (Y (CC C (BB CI (B (BB (bind (P ob)) K)) (SS C (CC C (BB BB bind) K) (C (CC bind) (K (P cb))))) P)) |
104 | 107 |
|
105 |
| - #define brac b (S bind (B Y (C (BB B B bind) (S (BB S (BB S (S I)) (CC (BB (B K)) (BB K) pair)) (CC S (CC BB (BB C (C (CI sp)) CI)) pair))))) |
| 108 | +l trans b (Y (B (bind gns) (S (BB S (C lm) lam) (C (BB S (C ob) brac) (S (C cb (CI (atom sp))) (S (C ef (CI (atom sp))) (B CI atom))))))) |
106 | 109 |
|
107 |
| - #define lam b (B (bind gns) (C (CC BB bind (B CI)) abs)) |
| 110 | +l brac b (S bind (B Y (C (BB B B bind) (S (BB S (BB S (S I)) (CC (BB (B K)) (BB K) pair)) (CC S (CC BB (BB C (C (CI sp)) CI)) pair))))) |
| 111 | + |
| 112 | +l lam b (B (bind gns) (C (CC BB bind (B CI)) abs)) |
108 | 113 |
|
109 |
| - #define abs b (Y (C (BB S (BB C CI) (SS S (BB C (BB B opt)) I)) (CC S (C C (atom qi)) (B (pair (atom qk)) atom)))) |
| 114 | +l abs b (Y (C (BB S (BB C CI) (SS S (BB C (BB B opt)) I)) (CC S (C C (atom qi)) (B (pair (atom qk)) atom)))) |
110 | 115 |
|
111 |
| - #define make b (B pair (pair (atom qs))) |
| 116 | +l make b (B pair (pair (atom qs))) |
112 | 117 |
|
113 |
| - #define opt b (S (S I (S (BB (CC B) CI (BB K K make)) (S (BB C (BB C (C (CI qk))) (SS (SS S) (S (BB (BB (S I)) S (BB (BB (CC B) CI) (BB K K) make)) (B (CC B (BB (CC C) (BB (C (CI qk)) (pair (atom qk))) pair)) make)) (B (C (BB B C (C (CI qi)))) make))) make))) (B K make)) |
| 118 | +l opt b (S (S I (S (BB (CC B) CI (BB K K make)) (S (BB C (BB C (C (CI qk))) (SS (SS S) (S (BB (BB (S I)) S (BB (BB (CC B) CI) (BB K K) make)) (B (CC B (BB (CC C) (BB (C (CI qk)) (pair (atom qk))) pair)) make)) (B (C (BB B C (C (CI qi)))) make))) make))) (B K make)) |
114 | 119 |
|
115 | 120 | (bind (bind trans pr) (P nl) I)
|
116 | 121 |
|
|
0 commit comments