in reply to Re^5: hrm, Eval::Compile
in thread hrm, Eval::Compile

Like Corion said, the key to implementing this design is delay :) Perl does it
$ perl -c -e " foo(1); " -e syntax OK
Even though foo() isn't defined yet, perl recognizes it as a function yet to be defined by the syntax(like your tags), so it holds off reporting an error as long as possible (runtime, when it tries to call it)
$ perl -e " foo(1); " Undefined subroutine &main::foo called at -e line 1.

H.O.P is all about this approach, build a tree, walk the tree, modify the tree, compute

The computable things are defined by syntax < >  [ ]  ( ), whether they'll actually compute or be returned verbatim is delayed until runtime

Like perl, TT2 takes the approach that if its not computable, its an error, not a string substitution

Your blind spot seems to be your current implementation -- you keep thinking in terms of substitution s/// instead of function/method calls -- even s/// is not really substitutions, its a series of function/method calls -- each call to s/// is a walk of the tree (flat tree, a string)

Replies are listed 'Best First'.
Re^7: hrm, Eval::Compile
by Logicus (Initiate) on Jul 21, 2011 at 00:26 UTC

    Oh how I wish I was a 17 year old whizz kid again... I'd have it coded up in no time. At 31 I feel 900 years old, burnt out, clapped out, one foot in the grave, someone please do me a favour and shoot me in the head.

    Ok, at the risk of really dumb, (like I haven't already), how do I build said "tree". I get what it is conceptually, but I'm thinking like a multi-level hash table solution? Is that a million miles from the answer?

    Oh how easy using n-dimensional arrays and fixed point math to do 3d graphics was back in the day... lol

      I get what it is conceptually, but I'm thinking like a multi-level hash table solution?

      Yes, you could uses Hash of Hashes. H.O.P chose Array of Arrays because arrays are already ordered and perl is very good at manipulating lists and arrays; you should chose AoA so you can leverage H.O.P. , HOP::Lexer, HOP::Parser

        Argh, more learning... can't I just pay someone to do it? Oh yeh that's right I got no money because I've spent the last 8 years goofing off and going down a code tangent all by my merry self. Bah....

        Actually I quite like arrays :)

        I think I can picture roughly how the solution is going to work, now, where did I put that text editor program... It's gotta be here somewhere... mumble mumble