A simplified embedded version of original BASIC. Some things work, some things just give utterly mysterious type errors.
Beware, this is just a fun weekend hack.
- getBASIC :: BASIC -> [Expr ()]
- type BASIC = Expr ()
- data PRINT = PRINT
- data END
- data LET = LET
- data GOTO
- data IF = IF
- data THEN = THEN
- data INPUT = INPUT
- data FOR = FOR
- data TO = TO
- data NEXT = NEXT
- data Expr a = (Expr a) := (Expr a)
- (<>) :: Expr a -> Expr a -> Expr a
- (==) :: Expr a -> Expr a -> Expr a
- (<) :: Expr a -> Expr a -> Expr a
- (>) :: Expr a -> Expr a -> Expr a
- (<=) :: Expr a -> Expr a -> Expr a
- (>=) :: Expr a -> Expr a -> Expr a
- (^) :: Expr a -> Expr a -> Expr a
- data Expr a
- = Cmd Integer Command [Expr a]
- | Str String
- | Dbl Double
- | Label Integer
- | Binop (Expr a) String (Expr a)
- | (Expr a) := (Expr a)
- | SIN (Expr a)
- | COS (Expr a)
- | TAN (Expr a)
- | ATN (Expr a)
- | EXP (Expr a)
- | LOG (Expr a)
- | RND (Expr a)
- | INT (Expr a)
- | SGN (Expr a)
- | ABS (Expr a)
- | SQR (Expr a)
- | Var
- | A
- | B
- | C
- | D
- | E
- | F
- | G
- | H
- | I
- | J
- | K
- | L
- | M
- | N
- | O
- | P
- | Q
- | R
- | S
- | T
- | U
- | V
- | W
- | X
- | Y
- | Z
- | None
- cmdLabel :: Expr a -> Integer
- data Command
- type BASIC = Expr ()
- runBASIC :: BASIC -> IO ()
- runBASIC' :: BASIC -> IO ()
Documentation
Monad Expr | |
Typeable1 Expr | |
Eq (Expr a) | |
Fractional (Expr a) | |
Num (Expr a) | |
Ord (Expr a) | |
Show (Expr a) | |
IsString (Expr a) | |
Eq (NEXT -> Expr a -> Expr b) | |
Eq (TO -> t -> Expr a) | |
Eq (FOR -> Expr a -> Expr b) | |
Eq (INPUT -> Expr a -> Expr b) | |
Eq (THEN -> t -> Expr a) | |
Eq (IF -> Expr a -> Expr b) | |
Eq (GOTO -> t -> Expr a) | |
Eq (LET -> Expr a -> Expr b) | |
Eq (END -> Expr a) | |
Eq (PRINT -> t -> Expr a) | |
Eq (PRINT -> Expr a -> Expr b) | |
(Show t, Typeable t) => Fractional (TO -> t -> Expr a) | |
Num (NEXT -> Expr a -> Expr b) | |
(Show t, Typeable t) => Num (TO -> t -> Expr a) | |
Num (FOR -> Expr a -> Expr b) | |
Num (INPUT -> Expr a -> Expr b) | |
Integral t => Num (THEN -> t -> Expr a) | |
Num (IF -> Expr a -> Expr b) | |
Integral t => Num (GOTO -> t -> Expr a) | |
Num (LET -> Expr a -> Expr b) | |
Num (END -> Expr a) | |
(Show t, Typeable t) => Num (PRINT -> t -> Expr a) | |
Num (PRINT -> Expr a -> Expr b) | |
Show (NEXT -> Expr a -> Expr b) | |
Show (TO -> t -> Expr a) | |
Show (FOR -> Expr a -> Expr b) | |
Show (INPUT -> Expr a -> Expr b) | |
Show (THEN -> t -> Expr a) | |
Show (IF -> Expr a -> Expr b) | |
Show (GOTO -> t -> Expr a) | |
Show (LET -> Expr a -> Expr b) | |
Show (END -> Expr a) | |
Show (PRINT -> t -> Expr a) | |
Show (PRINT -> Expr a -> Expr b) |
Cmd Integer Command [Expr a] | |
Str String | |
Dbl Double | |
Label Integer | |
Binop (Expr a) String (Expr a) | |
(Expr a) := (Expr a) | |
SIN (Expr a) | |
COS (Expr a) | |
TAN (Expr a) | |
ATN (Expr a) | |
EXP (Expr a) | |
LOG (Expr a) | |
RND (Expr a) | |
INT (Expr a) | |
SGN (Expr a) | |
ABS (Expr a) | |
SQR (Expr a) | |
Var | |
A | |
B | |
C | |
D | |
E | |
F | |
G | |
H | |
I | |
J | |
K | |
L | |
M | |
N | |
O | |
P | |
Q | |
R | |
S | |
T | |
U | |
V | |
W | |
X | |
Y | |
Z | |
None |
Monad Expr | |
Typeable1 Expr | |
Eq (Expr a) | |
Fractional (Expr a) | |
Num (Expr a) | |
Ord (Expr a) | |
Show (Expr a) | |
IsString (Expr a) | |
Eq (NEXT -> Expr a -> Expr b) | |
Eq (TO -> t -> Expr a) | |
Eq (FOR -> Expr a -> Expr b) | |
Eq (INPUT -> Expr a -> Expr b) | |
Eq (THEN -> t -> Expr a) | |
Eq (IF -> Expr a -> Expr b) | |
Eq (GOTO -> t -> Expr a) | |
Eq (LET -> Expr a -> Expr b) | |
Eq (END -> Expr a) | |
Eq (PRINT -> t -> Expr a) | |
Eq (PRINT -> Expr a -> Expr b) | |
(Show t, Typeable t) => Fractional (TO -> t -> Expr a) | |
Num (NEXT -> Expr a -> Expr b) | |
(Show t, Typeable t) => Num (TO -> t -> Expr a) | |
Num (FOR -> Expr a -> Expr b) | |
Num (INPUT -> Expr a -> Expr b) | |
Integral t => Num (THEN -> t -> Expr a) | |
Num (IF -> Expr a -> Expr b) | |
Integral t => Num (GOTO -> t -> Expr a) | |
Num (LET -> Expr a -> Expr b) | |
Num (END -> Expr a) | |
(Show t, Typeable t) => Num (PRINT -> t -> Expr a) | |
Num (PRINT -> Expr a -> Expr b) | |
Show (NEXT -> Expr a -> Expr b) | |
Show (TO -> t -> Expr a) | |
Show (FOR -> Expr a -> Expr b) | |
Show (INPUT -> Expr a -> Expr b) | |
Show (THEN -> t -> Expr a) | |
Show (IF -> Expr a -> Expr b) | |
Show (GOTO -> t -> Expr a) | |
Show (LET -> Expr a -> Expr b) | |
Show (END -> Expr a) | |
Show (PRINT -> t -> Expr a) | |
Show (PRINT -> Expr a -> Expr b) |