| I wrote one in erlang that works pretty well and is even designed to be able to call into erlang functions (if I took it that far). https://github.com/breckinloggins/erlisp I'm currently working on writing one in Haskell using the Scheme48 tutorial [1], though I'd eventually like to replace the evaluator with an F-Algebra[2] so I can learn about that. https://github.com/breckinloggins/scheme48 As a side note, would any Haskellers be willing to look at the abstraction I did for parsing #-forms? I created an adhoc data structure: hashLiteralInfo = [
('f', (Nothing, \_ -> Bool False)),
('t', (Nothing, \_ -> Bool True)),
('b', (Just $ many $ oneOf "01", Number . toInteger . fromBase 2)),
('o', (Just $ many $ oneOf "01234567", Number . toInteger . fromBase 8)),
('d', (Just $ many $ oneOf "0123456789", Number . toInteger . fromBase 10)),
('h', (Just $ many $ oneOf "0123456789abcdefABCDEF", Number . toInteger . fromBase 16))
]
And then the parser consumes that: parseHashLiteral :: Parser LispVal
parseHashLiteral = do
char '#'
c <- oneOf $ map fst hashLiteralInfo
let literalInfo = lookup c hashLiteralInfo
case literalInfo of
Nothing -> fail "Internal parse error: unregistered literal info"
Just (Nothing, f) -> return $ f "unneeded" -- I know there's a more idiomatic way to do that
Just (Just literalParser, f) -> do
digits <- literalParser
return $ f digits
This works and is "abstracted", but doesn't feel idiomatic. Thoughts?[1] http://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_H... [2] http://bartoszmilewski.com/2013/06/10/understanding-f-algebr... |