[prev in list] [next in list] [prev in thread] [next in thread] 

List:       antlr-dev
Subject:    Re: [antlr-dev] [antlr-interest] ignoring auto template
From:       Loring Craymer <lgcraymer () yahoo ! com>
Date:       2008-04-05 0:37:08
Message-ID: 591641.71215.qm () web55905 ! mail ! re3 ! yahoo ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Ter--

The solution I implemented in Yggdrasil depends on a few key insights:

1.)   ST output provides real visibility into the input stream (or anidealized, \
user-friendly. tweaked version of the input stream), and that visibility can be \
provided to development tools to provide RAD support, not just pretty output but \
pretty output that makes the tools more usable. 2.)  The ST structuring mechanism is \
via named slots and is fundamentally different from the tree structuring mechanisms \
which determine order in an output "stream". 3.)  The proper view for AST versus ST \
output is not  "either/or" but "and/or".  The printing of intermediate forms should \
not require a grammar dedicated to template output:  that just prolongs the \
development process.  Oddly enough, I think that this is the fundamental \
insight--none of the possibilities I explored "felt right" until I got here. 4.) \
Heavy duty rearrangement of the input stream should be done through trees; a \
minimalist syntax for ST support is sufficient.  The first class attributes in \
Yggdrasil can support major rewrites of template outputs, but I consider that \
fortuitous; the real benefits are visualization and a more rapid development cycle.

Efficiency is achieved through code generation flags--either the ST generation \
support is included in the target code generated from a grammar or not.

Cheers!

--Loring



----- Original Message ----
From: Terence Parr <parrt@cs.usfca.edu>
To: antlr-interest Interest <antlr-interest@antlr.org>
Cc: antlr-dev list <antlr-dev@antlr.org>
Sent: Friday, April 4, 2008 3:43:58 PM
Subject: [antlr-interest] ignoring auto template construction for now

Hi. decided it's too hard to get a perfect solution in short order.  i  
easily added auto temp construction but got stuck thinking about  
efficiency and hidden channel stuff.

For now, i realized I can just add this to rules that must return the  
text by default, which suits my purposes with output=template and  
rewrite=true at moment:

@after {
if ( $st==null ) {
    StringTemplate t = %{"<element>"};
    %t.element = $text;
    $st = t;
}
}

Ter






      ____________________________________________________________________________________
 You rock. That's why Blockbuster's offering you one month of Blockbuster Total \
Access, No Cost.   http://tc.deals.yahoo.com/tc/blockbuster/text5.com


[Attachment #5 (text/html)]

<html><head><style type="text/css"><!-- DIV {margin:0px;} \
--></style></head><body><div style="font-family:times new roman, new york, times, \
serif;font-size:12pt"><div style="font-family: times new roman,new york,times,serif; \
font-size: 12pt;">Ter--<br><br>The solution I implemented in Yggdrasil depends on a \
few key insights:<br><br>1.) &nbsp; ST output provides real visibility into the input \
stream (or an idealized, user-friendly. tweaked version of the input stream), and \
that visibility can be provided to development tools to provide RAD support, not just \
pretty output but pretty output that makes the tools more usable.<br>2.)&nbsp; The ST \
structuring mechanism is via named slots and is fundamentally different from the tree \
structuring mechanisms which determine order in an output "stream".<br> 3.)&nbsp; The \
proper view for AST versus ST output is not&nbsp; "either/or" but "and/or".&nbsp; The \
printing of intermediate forms should not require a grammar dedicated to template \
output:&nbsp; that just prolongs the development process.&nbsp; Oddly enough, I think \
that this is the fundamental insight--none of the possibilities I explored "felt \
right" until I got here.<br>4.) Heavy duty rearrangement of the input stream should \
be done through trees; a minimalist syntax for ST support is sufficient.&nbsp; The \
first class attributes in Yggdrasil can support major rewrites of template outputs, \
but I consider that fortuitous; the real benefits are visualization and a more rapid \
development cycle.<br><br>Efficiency is achieved through code generation \
flags--either the ST generation support is included in the target code generated from \
a grammar or not.<br><br>Cheers!<br><br>--Loring<br><br><br><br><div \
style="font-family: times new roman,new  york,times,serif; font-size: 12pt;">----- \
Original Message ----<br>From: Terence Parr &lt;parrt@cs.usfca.edu&gt;<br>To: \
antlr-interest Interest &lt;antlr-interest@antlr.org&gt;<br>Cc: antlr-dev list \
&lt;antlr-dev@antlr.org&gt;<br>Sent: Friday, April 4, 2008 3:43:58 PM<br>Subject: \
[antlr-interest] ignoring auto template construction for now<br><br>Hi. decided it's \
too hard to get a perfect solution in short order.&nbsp; i&nbsp; <br>easily added \
auto temp construction but got stuck thinking about&nbsp; <br>efficiency and hidden \
channel stuff.<br><br>For now, i realized I can just add this to rules that must \
return the&nbsp; <br>text by default, which suits my purposes with output=template \
and&nbsp; <br>rewrite=true at moment:<br><br>@after {<br>if ( $st==null ) \
{<br>&nbsp;&nbsp;&nbsp; StringTemplate t = \
%{"&lt;element&gt;"};<br>&nbsp;&nbsp;&nbsp; %t.element = $text;<br>&nbsp;&nbsp;&nbsp; \
$st = t;<br>}<br>}<br><br>Ter<br></div><br></div></div><br>

      <hr size=1>You rock. That's why Blockbuster's offering you <a \
href="http://us.rd.yahoo.com/evt=47523/*http://tc.deals.yahoo.com/tc/blockbuster/text5.com">one \
month of Blockbuster Total Access</a>, No Cost.</body></html>



_______________________________________________
antlr-dev mailing list
antlr-dev@antlr.org
http://www.antlr.org:8080/mailman/listinfo/antlr-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic