On Thu, Jul 9, 2015 at 1:10 PM, Frédéric THOMAS <webdoubl...@hotmail.com> wrote:
> > It's antlr 3 grammar if I remember correctly, hah maybe even antlr 2. I > > can't remember. > > I would guess 2 because I've seem ANTLR 3 examples and the grammar version > was in, never seen it with previous ones, I could be wrong. > > > It can't be used in it's current state because of the LinkedList class I > > used but the grammar could be the start of an antlr grammar Falcon could > > use if that is your question. And yes, then it could replace JFlex > because > > we would then have an ASDocParser class generated from antlr. > > Cool, I'm happy you know and did so much things on compilers, I will > probably come back to you and discuss it here when I will have get more > knowledges and will have done my experiments. > > Well not so much compilers, I am still a newbie when it comes to byte code stuff and binary math/operations etc. But I know parsers/lexers/scanners/AST pretty freaking well. ;-) Mike > Cheers, > Frédéric THOMAS > > > ---------------------------------------- > > Date: Thu, 9 Jul 2015 12:59:04 -0400 > > Subject: Re: [FalconJX] Collection Imports branch > > From: teotigraphix...@gmail.com > > To: dev@flex.apache.org > > > > On Thu, Jul 9, 2015 at 12:54 PM, Frédéric THOMAS < > webdoubl...@hotmail.com> > > wrote: > > > >>> > >> > >> > https://github.com/teotigraphix/as3-commons-jasblocks/blob/master/src/main/java/org/as3commons/asblocks/parser/antlr/asdoc/ASDoc.g > >> > >> Hum, I don't know how to read JFlex and ANTLR yet and then, I'm not sure > >> what I'm seeing here, is that a ANTLR ASDoc grammar that could replace > the > >> JFlex one ? > >> > > > > It's antlr 3 grammar if I remember correctly, hah maybe even antlr 2. I > > can't remember. > > > > It can't be used in it's current state because of the LinkedList class I > > used but the grammar could be the start of an antlr grammar Falcon could > > use if that is your question. And yes, then it could replace JFlex > because > > we would then have an ASDocParser class generated from antlr. > > > > Mike > > > > > > > >> > >> Frédéric THOMAS > >> > >> > >> ---------------------------------------- > >>> Date: Thu, 9 Jul 2015 12:19:16 -0400 > >>> Subject: Re: [FalconJX] Collection Imports branch > >>> From: teotigraphix...@gmail.com > >>> To: dev@flex.apache.org > >>> > >>> FYI, I did this way back in 2010. :) > >>> > >>> > >> > https://github.com/teotigraphix/as3-commons-jasblocks/blob/master/src/main/java/org/as3commons/asblocks/parser/antlr/asdoc/ASDoc.g > >>> > >>> Mike > >>> > >>> On Thu, Jul 9, 2015 at 12:17 PM, Michael Schmalle < > >> teotigraphix...@gmail.com > >>>> wrote: > >>> > >>>> > >>>> > >>>> On Thu, Jul 9, 2015 at 12:01 PM, Frédéric THOMAS < > >> webdoubl...@hotmail.com> > >>>> wrote: > >>>> > >>>>>> You're not traversing anything, it just happens that the base class > is > >>>>>> abstract and defines callbacks for recursion. In your case you just > >>>>> want a > >>>>>> "processing" compiler pass. > >>>>>> > >>>>>> A plain old compiler pass wouldn't require visiting all nodes, just > a > >>>>>> process(). > >>>>>> > >>>>>> Don't worry about it, the two you overrode are just stubs. > >>>>> > >>>>> Well, I got I did an override :-) I just was trying to understand the > >>>>> base classes. > >>>>> > >>>> > >>>> > >>>> The base class why my design and for all the passes I did, I needed > the > >>>> callbacks. See NodeTraversal.travese() I think it is, that is what > >> actually > >>>> calls the callbacks and shouldTravese(), it's in the GCC API. > >>>> > >>>> You could have just implemented Callback with process() and created > your > >>>> won constructor if that makes it more clear, it wasn't neccessary to > >>>> subclass but, it was there so, ya know. :) > >>>> > >>>> > >>>> > >>>>> > >>>>> Anyway, thanks again Mike for your explanations ! > >>>>> > >>>>> I will now go back on Falcon starting from the beginning trying to > >>>>> understand the scan / parse phase, even if I understand > >> approximatively how > >>>>> theoretically it should work, it seems a huge thing to me in there, I > >> see > >>>>> JFlex, ANTLR, btw I thought it was possible to do the scan / parse > with > >>>>> ANTLR only, am I wrong ? if not why are we using JFlex too ? > >>>>> > >>>> > >>>> > >>>> JFlex is used to create the RawASDocTokenizer. So yes, if a grammar > was > >>>> created for asdoc parsing in antlr, we could get rid of JFlex > dependency > >>>> because I think that is the only place it's used. > >>>> > >>>> Mike > >>>> > >>>> > >>>> > >>>>> > >>>>> I will try to experiment, even with ANTLR4.x > >>>>> > >>>>> Frédéric THOMAS > >>>>> > >>>>> > >>>>> ---------------------------------------- > >>>>>> Date: Thu, 9 Jul 2015 11:25:09 -0400 > >>>>>> Subject: Re: [FalconJX] Collection Imports branch > >>>>>> From: teotigraphix...@gmail.com > >>>>>> To: dev@flex.apache.org > >>>>>> > >>>>>> You're not traversing anything, it just happens that the base class > is > >>>>>> abstract and defines callbacks for recursion. In your case you just > >>>>> want a > >>>>>> "processing" compiler pass. > >>>>>> > >>>>>> A plain old compiler pass wouldn't require visiting all nodes, just > a > >>>>>> process(). > >>>>>> > >>>>>> Don't worry about it, the two you overrode are just stubs. > >>>>>> > >>>>>> Mike > >>>>>> > >>>>>> On Thu, Jul 9, 2015 at 11:13 AM, Frédéric THOMAS < > >>>>> webdoubl...@hotmail.com> > >>>>>> wrote: > >>>>>> > >>>>>>>> Other than that, merge/commit it man! thanks, looks good to me, we > >>>>> will > >>>>>>> see > >>>>>>>> if anything else comes up. > >>>>>>> > >>>>>>> Thanks, done ! > >>>>>>> > >>>>>>> But I'm still confuse with the pattern: > >>>>>>> > >>>>>>> I didn't get well this thing about pre / post order in the Callback > >>>>>>> interface maybe I didn't get what it means, isn't supposed to be > >>>>> recursive > >>>>>>> descendant only, how does it work ? > >>>>>>> I used process() which traverseRoots of both externs (the most out > of > >>>>>>> parent) and the given node, why 2 nodes have to be traversed in the > >>>>> same > >>>>>>> function ? > >>>>>>> > >>>>>>> Frédéric THOMAS > >>>>>>> > >>>>>>> > >>>>>>> ---------------------------------------- > >>>>>>>> Date: Wed, 8 Jul 2015 16:46:34 -0400 > >>>>>>>> Subject: [FalconJX] Collection Imports branch > >>>>>>>> From: teotigraphix...@gmail.com > >>>>>>>> To: dev@flex.apache.org > >>>>>>>> > >>>>>>>> Hey Fred, > >>>>>>>> > >>>>>>>> Couple things; > >>>>>>>> > >>>>>>>> 1. CollectImportsPass > >>>>>>>> > >>>>>>>> Should probably be; (process() only gets called once) > >>>>>>>> > >>>>>>>> @Override > >>>>>>>> public void process(Node externs, Node root) > >>>>>>>> { > >>>>>>>> for (ClassReference reference : model.getClasses()) > >>>>>>>> { > >>>>>>>> collectClassImports(reference); > >>>>>>>> } > >>>>>>>> > >>>>>>>> for (FunctionReference reference : model.getFunctions()) > >>>>>>>> { > >>>>>>>> collectFunctionImports(reference); > >>>>>>>> } > >>>>>>>> } > >>>>>>>> > >>>>>>>> @Override > >>>>>>>> public boolean shouldTraverse(final NodeTraversal nodeTraversal, > >> final > >>>>>>>> Node n, final Node parent) > >>>>>>>> { > >>>>>>>> return false; > >>>>>>>> } > >>>>>>>> > >>>>>>>> @Override > >>>>>>>> public void visit(final NodeTraversal t, final Node n, final Node > >>>>>>>> parent) > >>>>>>>> { > >>>>>>>> } > >>>>>>>> > >>>>>>>> > >>>>>>>> Other than that, merge/commit it man! thanks, looks good to me, we > >>>>> will > >>>>>>> see > >>>>>>>> if anything else comes up. > >>>>>>>> > >>>>>>>> Mike > >>>>>>> > >>>>>>> > >>>>> > >>>>> > >>>> > >>>> > >> > >> > >