TT3 Has Real Expressions™
%% name or 'World' %% foo or (bar and baz < wam or bam) %% a + b * c / d * (e + f / (g + d))--EOF--look inside...
- Everything is an expression
- All expressions are interchangeable
- Operator precedence drives it all
- Everything Just Works™
Thus Spake Andy:
TT3 has a "real" parser. TT2 also had a "real" parser, but it was a table based parser using a YACC-like grammar. It was inflexible and rather fragile. It was almost impossible to change one thing without breaking something else. It had some precedence problems that were impossible to fix (to the best of my knowledge and/or ability). TT3 uses a hand-crafted recursive descent operator precedence parser. It's loosely based on Pratt's parser from his 1973 paper. See O'Reilly's Beautiful Code for a great introduction to this parser by Douglas Crockford complete with an implementation in Javascript. The Perl implementation is similar in spirit but slightly different in practice. It solves all known problems in a simple, elegant, and most importantly, extensible manner. New commands can be loaded into the language on the fly and it Just Works™.
In TT3 everything is an expression (even text chunks - they're just static expressions that always yield the same result). All expressions are interchangeable, meaning that you can write a complex sub-expression anywhere you can put a variable. No more intermediate variables!