This is my first take of trying functional programming with Haskell
Seriously, it is very hard to grasp all the concept of this programming paradigm. However, I really enjoyed about this languages
- Install
ghc
andghci
in the machine - Clone this repository
- Run
ghci <hs_file>
- All parsing statement start with
parse
A general parser for any type of String
*Parser> parse (char 'a') "abc"
Just ('a',"bc")
*Parser> parse (string "foo") "foobar"
Just ("foo","bar")
A parser spacialized for JSON string
The grammar of JSON can be found here
*JsonParser> parse jsonObject "{ \"hello\" : 123, \"foo\": \"bar bar\"} gssgs"
Just (JsonObject [("hello",JsonNumber 123),("foo",JsonString "bar bar")]," gssgs")
- Add
IO
- Parse floating numbers for JSON
- Implement
ParserError
- Add test
-
Parser
-
JsonParser
-
- More parser such as HTML, CSS, math expression