0 | |
> -- coding: UTF-8
|
|
0 |
-> encoding: UTF-8
|
1 | 1 |
|
2 | 2 |
The Burro Programming Language
|
3 | 3 |
==============================
|
|
40 | 40 |
the idea that Burro qualifies as universal.
|
41 | 41 |
|
42 | 42 |
For further background information on the Burro project, you may also wish
|
43 | |
to read the [Burro 1.0 article](burro-1.0.html), with the understanding that
|
44 | |
the language description given there is obsolete.
|
|
43 |
to read the [Burro 1.0 article](../doc/burro-1.0.html), with the understanding
|
|
44 |
that the language description given there is obsolete.
|
45 | 45 |
|
46 | 46 |
|
47 | 47 |
Changes from Burro 1.0
|
|
110 | 110 |
> show GoRight = ">"
|
111 | 111 |
> show (Test a b) = "(" ++ (show a) ++ "/" ++ (show b) ++ ")"
|
112 | 112 |
> show (Seq a b) = (show a) ++ (show b)
|
113 | |
>
|
|
113 |
>
|
114 | 114 |
> parse string =
|
115 | 115 |
> let
|
116 | 116 |
> (rest, acc) = parseProgram string Null
|
117 | 117 |
> in
|
118 | 118 |
> trim acc
|
119 | |
>
|
|
119 |
>
|
120 | 120 |
> parseProgram [] acc =
|
121 | 121 |
> ([], acc)
|
122 | 122 |
> parseProgram ('e':rest) acc =
|
|
144 | 144 |
> (rest, acc)
|
145 | 145 |
> parseProgram (_:rest) acc =
|
146 | 146 |
> parseProgram rest acc
|
147 | |
>
|
|
147 |
>
|
148 | 148 |
> trim (Seq Null a) = trim a
|
149 | 149 |
> trim (Seq a Null) = trim a
|
150 | 150 |
> trim (Seq a b) = Seq (trim a) (trim b)
|
|
201 | 201 |
|
202 | 202 |
> data Tape = Tape [Integer] [Integer]
|
203 | 203 |
> deriving (Read)
|
204 | |
>
|
|
204 |
>
|
205 | 205 |
> instance Show Tape where
|
206 | 206 |
> show t@(Tape l r) =
|
207 | 207 |
> let
|
|
226 | 226 |
> ensurecell x = x
|
227 | 227 |
>
|
228 | 228 |
> strip (Tape l r) = Tape (ensurecell (stripzeroes l)) (stripzeroes r)
|
229 | |
>
|
|
229 |
>
|
230 | 230 |
> tapeeq :: Tape -> Tape -> Bool
|
231 | 231 |
> tapeeq t1 t2 =
|
232 | 232 |
> let
|
|
234 | 234 |
> (Tape t2l t2r) = strip t2
|
235 | 235 |
> in
|
236 | 236 |
> (t1l == t2l) && (t1r == t2r)
|
237 | |
>
|
|
237 |
>
|
238 | 238 |
> instance Eq Tape where
|
239 | 239 |
> t1 == t2 = tapeeq t1 t2
|
240 | 240 |
|
|
274 | 274 |
|
275 | 275 |
> data State = State Tape Tape Bool
|
276 | 276 |
> deriving (Show, Read, Eq)
|
277 | |
>
|
|
277 |
>
|
278 | 278 |
> newstate = State (tape [0]) (tape [0]) True
|
279 | 279 |
|
280 | 280 |
|