[metaas-dev] metaas-dev Digest, Vol 17, Issue 3

Yuliang-Yang zjuyyl at gmail.com
Thu May 8 14:06:33 BST 2008


2008/5/8, metaas-dev-request at lists.badgers-in-foil.co.uk <
metaas-dev-request at lists.badgers-in-foil.co.uk>:
>
> Send metaas-dev mailing list submissions to
>        metaas-dev at lists.badgers-in-foil.co.uk
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://lists.badgers-in-foil.co.uk/mailman/listinfo/metaas-dev
> or, via email, send a message with subject or body 'help' to
>        metaas-dev-request at lists.badgers-in-foil.co.uk
>
> You can reach the person managing the list at
>        metaas-dev-owner at lists.badgers-in-foil.co.uk
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of metaas-dev digest..."
>
>
> Today's Topics:
>
>   1. Re: method.addStmt("super.executeNextCommand()") (David Holroyd)
>   2. Re: Sorting methods by name output parameters (David Holroyd)
>   3. Re: Reusing the ANTLR grammar (David Holroyd)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 7 May 2008 21:58:25 +0000
> From: David Holroyd <dave at badgers-in-foil.co.uk>
> Subject: Re: [metaas-dev] method.addStmt("super.executeNextCommand()")
> To: metaas-dev at lists.badgers-in-foil.co.uk
> Message-ID: <20080507215824.GA4514 at badgers-in-foil.co.uk>
> Content-Type: text/plain; charset=us-ascii
>
> On Tue, May 06, 2008 at 08:44:42PM +0800, Yuliang-Yang wrote:
> > when I use method.addStmt("super.executeNextCommand()");
> > the compiler complains,,
> > this method is override method of the super class.
> > Exception in thread "main" uk.co.badgersinfoil.metaas.SyntaxException:
> > Unexpected token DOT in "super.executeNextCommand()" at line 1
>
> Unfortunatly, this is due to incompleteness of the AS3 parser built into
> metaas.  Several people have reported this problem so I'll try to tackle
> this first when I get back on to metaas stuff.
>
> Sorry about that!
>
>
> > and I also haven't find define a method with modifier "override",maybe
> this
> > is cause by not modifiy with "override";
>
> I don't think that the message related to 'override' is coming from
> metaas.  Something to do with your application?


My usecase is that i want generate a subclass of A,which is B, and class A
have a method executeNextCommand,
when I generate B's executeNextCommand I just use ASMethod method =
clazz.newMethod("executeNextCommand",,,somemodify),
and then use method.addStmt("super.executeNextCommand()");  so the parser
complain :(

ta,
> dave
>
> --
> http://david.holroyd.me.uk/
>
>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 7 May 2008 22:16:58 +0000
> From: David Holroyd <dave at badgers-in-foil.co.uk>
> Subject: Re: [metaas-dev] Sorting methods by name output parameters
> To: metaas-dev at lists.badgers-in-foil.co.uk
> Message-ID: <20080507221657.GB4514 at badgers-in-foil.co.uk>
> Content-Type: text/plain; charset=us-ascii
>
> Hi there!
>
> On Tue, May 06, 2008 at 09:17:23AM +0200, Florian Salihovic wrote:
> > I'm currently working on a code generator for my own needs. Metaas is
> > a great help so far. But in order to navigate through my classes a lil
> > easier i have this habit to write my methods in alphabetical order. I
> > thought of sorting the code regarding my needs with metaas, but the
> > list regarding the methods is read only. Do i have to sort the classes
> > by hand?
>
> Well, I'm sorry to say that in-place modification of the contents of
> code blocks is not supported yet :(
>
> The underlying Abstract Syntax Tree data structure could allow this kind
> of change with a bit of work, but the public API doesn't have the
> features yet.
>
> I accept patches! ;)
>
> The only way of really doing this currently might be to walk the entire
> contents of the ASCompilationUnit, creating a duplicate of everything,
> but adding the duplicate methods in alphabetical order.  That would
> really be a lot of effort though.
>
>
> > Also i'd like to know if some sort of output parameters are planned to
> > be implemented in the nearer future (whitespaces between operands and
> > operators, additional linebreaks between methods...).
>
> I have had some thoughts, and getting the configuration data to the
> places that need it seems to be the main challenge.
>
> i.e. it should be possible to tweak the settings in the
> ActionScriptFactory and then an ASBlock.newIf(...) should just do the
> right thing -- however, I don't yet have a simple way to get at that
> info from within the ASTStatementlList instance.  Maybe one could walk
> up the AST to the root node, and have the instance object there hold a
> reference to the factory..?  Well, there are other bugs to fix first I
> think.
>
> It is on my TODO list though!
>
>
> ta,
> dave
>
> --
> http://david.holroyd.me.uk/
>
>
>
> ------------------------------
>
> Message: 3
> Date: Wed, 7 May 2008 22:25:48 +0000
> From: David Holroyd <dave at badgers-in-foil.co.uk>
> Subject: Re: [metaas-dev] Reusing the ANTLR grammar
> To: metaas-dev at lists.badgers-in-foil.co.uk
> Message-ID: <20080507222547.GC4514 at badgers-in-foil.co.uk>
> Content-Type: text/plain; charset=us-ascii
>
> Hello,
>
> On Mon, Apr 28, 2008 at 02:28:50PM -0700, Don-Duong Quach wrote:
> > I'm trying to build an Actionscript 3 to haxe http://haxe.orgtranslator,
> > and I've been taking a closer look at metaas to see if I could reuse the
> AS3
> > and island grammars as the basis for it.  I thought I might as well try
> to
> > build something robust with ANTLR than hand code a translator, but I've
> into
> > a couple snags with building the project.
> >
> > I was hoping maybe David Holroyd or someone would give me some pointers
> on
> > how to alter the grammar into a tree grammar for rewriting as I'm still
> > learning how to use ANTLR.
> >
> > Just as a side note, I setup Netbeans with a Maven plugin to build the
> > metaas project but ran into some dependency issues with the
> maven-archiver,
> > plexus-archiver and plexus-components.  I stopped trying to resolve them
> at
> > that point because I wanted to focus on the task of the tree grammar.
>
> I'm afraid I have no experience of Netbeans/Maven integration, so I
> can't really help out there.  Were you able to get things to work with
> the plain-old Maven command line interface?
>
>
> > I've been reading through the docs and examples, but I don't know I
> would
> > translate the certain parser rewrites into a tree grammar rule.  For
> > example:
> >
> > classDefinition[LinkedListTree annos, LinkedListTree mods]
> >     :    CLASS ident
> >         classExtendsClause
> >         implementsClause
> >         typeBlock
> >         -> ^(CLASS_DEF {$annos} {$mods} ident classExtendsClause
> > implementsClause typeBlock)
> >     ;
> >
> > In The Definitive Guide to ANTLR, Terrence Parr says to copy the rules
> over
> > like so:
> >
> > classDefinition[LinkedListTree annos, LinkedListTree mods]
> >     :    ^(CLASS_DEF {$annos} {$mods} ident classExtendsClause
> > implementsClause typeBlock)
> >     ;
>
> Note that you would not need to pass the [annos,mods] arguments to this
> rule in the tree parser.  The main parser will already have inserted
> these into the resulting tree.
>
>
> > But what would I do about the {$annos} and {$mods} elements in the
> rule?  I
> > figure the parameter clause should be removed, but what should I use to
> > reference the annos and mods elements in the AST?
>
> You need to consider what structure the tree parser will actually
> observe.
>
> In the above example, {$annos} and {$mods} are references (passed as
> arguments to the rule) to some subtrees.  In your tree parser, you would
> need to address the concrete tree structure that will be produced that
> these points.
>
> If you look at the rules that may invoke the classDefinition rule,
> you'll see that $annos and $mods are the subtrees produced by the rules
> 'annotations' and 'modifiers' respectively.
>
> Therefore, you could write the rule in the tree parser like...
>
>
> classDefinition
>      :    ^(CLASS_DEF annotations modifiers ident classExtendsClause
> implementsClause typeBlock)
>
>
> does that make sense?
>
>
> ta,
> dave
>
> --
> http://david.holroyd.me.uk/
>
>
>
> ------------------------------
>
> _______________________________________________
> metaas-dev mailing list
> metaas-dev at lists.badgers-in-foil.co.uk
> http://lists.badgers-in-foil.co.uk/mailman/listinfo/metaas-dev
>
>
> End of metaas-dev Digest, Vol 17, Issue 3
> *****************************************
>



-- 
best regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.badgers-in-foil.co.uk/pipermail/metaas-dev/attachments/20080508/af6af565/attachment.htm 


More information about the metaas-dev mailing list