Reproduced pull request#3 after it got eaten by unprincipled git usage on the part of the maintainer.
Getty Ritter
9 years ago
| 77 | 77 | |
| 78 | 78 | main :: IO () |
| 79 | 79 | main = do |
| 80 |
sExprText <- pack . head <$> get |
|
| 80 | sExprText <- pack . head <$> getContents | |
| 81 | 81 | either putStrLn print (decode myLangParser sExprText) |
| 82 | 82 | |
| 83 | 83 | {- |
| 84 |
Ex |
|
| 84 | Example usage: | |
| 85 | 85 | |
| 86 | $ dist/build/example/example "$(echo -e '(+ (* 2 20) 10) (* 10 10)')" | |
| 87 | [EOp Add (EOp Mul (ENum 2) (ENum 20)) (ENum 10),EOp Mul (ENum 10) (ENum 10)] | |
| 86 | $ dist/build/example/example <<EOF | |
| 87 | > -- you can put comments in the code! | |
| 88 | > (+ 10 (* 20 20)) | |
| 89 | > -- and more than one s-expression! | |
| 90 | > (* 10 10) | |
| 91 | > EOF | |
| 92 | [EOp Add (ENum 10) (EOp Mul (ENum 20) (ENum 20)),EOp Mul (ENum 10) (ENum 10)] | |
| 88 | 93 | -} |