Submitted by thunder3 on Thu, 02/19/2009 - 18:59
I have often read that the best way to learn a language is to write an interpreter for it. So, with this in mind, I have begun work on writing a jQuery interpreter for HAML.
Does this make any practical sense? Well, I suppose it does, if you want an alternative to tossing around AJAX responses in HTML, XML or JSON. Mostly, however, I am doing this to learn more jQuery and HAML. If it goes really well, I may extend it to handle CSS assignments by SASS (now wouldn't that be SASS~y!).
As of where I left it today, it will parse simple HAML statements as well as attribute hashes.
The things I still need to work on include:
- Respecting whitespace compressing and formatting rules
- Implementing some counterpart to RHTML statements. I am trying to decide what makes sense for jQuery. Maybe eval statements?
- Boolean attribute values (eg: selected = "selected")
- Attribute methods and definition statements (have to play with the scoping for this...I don't want to make it globally scoped)
So yeah, that's just a taste of what's to come, but it's already super neat that I can take something like:
#great
%p.paraclass
Some nice text
%p#secondpara{:class => "greatness"} Some paragraph text
And it all works!



re
Thnx a lot for your useful writing referring to this good post. But to notice the perfect essay writing students should get some data about already written essays.
Re
Students sould treat paper writers really carefully, because they perform the good research paper writing associated with this good topic. So, that’s not a big problem to buy essay because of this at present time.