3 ms·
"I've seen ForTran programs written in Haskell, believe it or not." I once wrote a toy library that lets you write BASIC in Haskell: main = runBASIC $ do
by JoshTriplett 17y ago
"I've seen ForTran programs written in Haskell, believe it or not."
I once wrote a toy library that lets you write BASIC in Haskell:
main = runBASIC $ do
10 PRINT "BASIC in Haskell"
18 GOSUB 1000
20 GOTO 10
15 PRINT "Out-of-order line"
1000 PRINT "gosub"
1010 RETURN
(Yes, line numbers and all.)
Lennart Augustsson extended that to allow things like "10 PRINT 2 + 2" (no parentheses needed), along with most of the rest of BASIC; his approach effectively implemented a full parser and treated everything as a token. He also added LLVM-based code generation. See http://hackage.haskell.org/package/BASIC http://hackage.haskell.org/package/BASIC .