Hi Stef,
We could easily turn your blog into a chapter for a future book :) Wow! I didn't really expect that! But I'd happy to help any way I can. Maybe by adding some bits an pieces how to parse blocks with multiple expressions? I have that working for a project I'm working on - but it isn't nice enough for an article (yet).
I have the impression that the blog is how to avoid parsing and still get translation done! Let me put it that way: I love using PetitParser - but sometimes parsing an expression compared to full code is more than enough.
It also has the benefit of blending nicely with regular Smalltalk tools (code, not Strings!) w/o hooking into the compiler - which makes it more portable by default. So you're right - it provides a "kind of AST" which allows you to reason about some Smalltalk expression w/o relying on a full parser. I'll use it for translating only though... The limitations of this approach are clear - but if you need more than the tools you'll need are clear and known as well. CU, Udo On 25.09.14 22:06, stepharo wrote:
Hi udo
I agree with sven :)
We could easily turn your blog into a chapter for a future book :) I have the impression that the blog is how to avoid parsing and still get translation done!
Stef
Hi Sven,
thanks for the feedback.
Keep that kind of stuff coming, it is very helpful. I'll try to. It just always takes so long to write stuff. But I think you know that, don't you? :-)
CU,
Udo
On 23.09.14 16:00, Sven Van Caekenberghe wrote:
Hi Udo,
This is really an excellent article: I enjoyed reading it a lot.
It is well written, has lots of relevant code examples and a nice pace, but above all it is really interesting.
Thanks a lot.
Keep that kind of stuff coming, it is very helpful.
Sven
On 23 Sep 2014, at 01:48, Udo Schneider <udo.schneider@homeaddress.de> wrote:
All,
I just finished a blog entry. It shows how to use Smalltalk blocks as parsers/translators. E.g. translating a Block
[:customer | (customer joinDate year is: Date today year)]
into an SQL-like String
(YEAR(customers.joinDate) = 2014)
The SQL stuff is just an example - you can create nearly any output.
Check out http://readthesourceluke.blogspot.de/2014/09/block-translators-parsing-magic...
Maybe that's old stuff for some of you - but I hope it's interesting for some at least :-)
Comments and feedback appreciated.
CU,
Udo