Cirru Parser implemented in Go. Visit http://cirru.org for more.
You may also find one writtern in CoffeeScript.
You may find a complete demo at parser_test.go
. Here is an overview.
// import "github.com/Cirru/parser"
b, _ := ioutil.ReadFile("demo.cirru")
p := parser.NewParser()
p.Filename("_") // to specify filename
for _, c := range b {
p.Read(rune(c))
}
p.Complete()
content, _ := json.MarshalIndent(p.ToTree(), "", " ")
string(content) // in JSON
MIT