Let's say i'd like to re-invent CoffeeScript :) Or Python. Or Stylus, or YAML :) I need some tool, which will turn my indentation-base syntax into abstract syntax tree. Google unfortunately knowns nothing about [indentation-based sytntax to AST]. Do you guys know any tool like this? To be more specific, what I have
===source===
Lorem ipsum:
dolor sit amet:
consectetuer adipiscing elit
sed diam nonummy
nibh euismod tincidunt:
ut laoreet dolore
...and what I need:
===result===
[
{
directive: "Lorem ipsum",
content: [
{
directive: "dolor sit amet",
content: [
{directive: "consectetuer adipiscing elit", content: []}
]
},
{directive: "sed diam nonummy", content: []}
]
}, {
directive: "nibh euismod tincidunt",
content: [
{directive:"ut laoreet dolore", content: []}
]
}
]
It would be great, if you could recommend some tool like this. It would be awesome if this tool is written on python/javascript and display result as JSON. It would be also cool if you can give a piece of advice about how to create this tool-of-a-dream by myself :) Thanx!