logo       

Re: TT3 Reserved words could be less reserved: msg#00042

Subject: Re: TT3 Reserved words could be less reserved
mail-vAmMQTyk7hpBDgjK7y7TUQ@xxxxxxxxxxxxxxxx wrote:
> I have included a test program that tests what I am requesting.  I would like 
> to see the status of reserved words become a little less reserved.  There is 
> a lot of intuition that can be gathered based upon the place you are in. 

Yep, that's all part of TT3.  You can't do it (easily, if at all) in TT2 
because we tokenise everything up front.  We see GET and mark it as a 
keyword, and use that the drive the grammar forward (using YAPP).

In TT3 the parse is recursive descent and knows where to look for a keyword
and where it can safely look for a variable that might otherwise look
like a keyword.

Same goes for operators.  You should be able to have variables called 
'and' and 'or' if you really want to confuse people.

  [% IF IF and and or or %]   
      =>   <key:IF> <var:IF> <op:and> <var:and> <op:or> <var:or>
     ...
  [% ELSIF ELSIF or or and and %]  => 
      =>   <key:ELSIF> <var:ELSIF> <op:or> <var:or> <op:and> <var:and>

Obfuscated TT3 anyone?  :-)

Rewriting the parser was always the big part of TT3.  Apart from some
of the code generation and handling some of the more complex directives,
it's more-or-less done.  Certainly most of the low-level stuff like 
parsing TT statements.

One particularly shiny thing in TT3 is that you can use explicit namespaces 
to disambiguate the language elements if necessary.

For example, where you currently write:

   [% INCLUDE $filename %] 

the leading '$' in filename tells the parser that a variable name follows
rather than the unquoted filename it usually expects.  In TT3 you'll also
be able to say:

   [% INCLUDE var:filename %]

And if you want a template, file, image or some other kind of thingy where
you would normally get a variable, you can write:

   [% t = template:header %]   # [% t.modtime %], [% t.metadata %], etc.
   [% f = file:blah.txt   %]   # [% f.modtime %], [% f.owner %], etc.
   [% i = image:foo.gif   %]   # [% i.width %], [% i.height %]
   [% x = xml:example.xml %]   # [% x.dom.getElementsByTagName('h1') %]

All depending on what providers you've bound to your various namespaces,
of course.  In essence, all TT variables and other identifiers will be
addressable via URIs which makes things nicely, er, uniform.

Cheers
A


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
boot-loaders.gr...    php.pear.genera...    debugging.valgr...    kde.redhat.user...    text.xml.xsl.ge...    culture.languag...    hardware.microc...    java.servicemix...    redhat.release....    web.zope.plone....    user-groups.lin...    opendarwin.webk...    video.mjpeg.use...    sysutils.bcfg2....    encryption.gpg....    lx-office.devel...    xfree86.forum/2...    mail.mutt.devel...    acpi.devel/2003...    qnx.openqnx.dev...    network.irc.irs...    freebsd.devel.m...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe