On Mon, Apr 27, 2009 at 8:11 AM, StephenCraigEvans
<
stephencr...@gmail.com> wrote:
>
>
> Hi Jonathan,
>
> I just wanted to take the time to thank you for FreeCC and all of the
> work that you have put into it.
You're welcome. I guess I just did it mostly for the pure heck of it.
Sorry to have been slow responding. I've been rather busy with other
things, and freecc has been rather neglected for the last couple of
months. I still have to release a 0.9.4. I think the version one would
build from a SVN checkout is pretty useable. I had just meant to clean
up the docs and stuff a bit and then put it out, but I just got
sidetracked into other things.
>
> I'm playing around and writing a static source code analysis tool
> prototype because I want to learn how they work. I have produced
> partial source code program models in Java and PHP so far. At this
> stage I am keeping it simple so I enable tracing and replace the body
> of the trace_call, trace_return & trace_token functions then pass the
> relevant parameters to my own methods; from there I do the heavy
> lifting.
>
> Examples:
> private void trace_call(String s) {
> sm.processState("Call", s);
> }
>
> private void trace_token(Token t, String where) {
> String tokenValue = tokenImage[t.kind];
> Boolean b=false;
>
> if (t.kind!=0 && !tokenImage[t.kind].equals("\""+t.image+"\"")) {
> b = true;
> }
>
> sm.processState(t, where, tokenValue, b);
> }
>
>
> I realize it's a very primitive way to use FreeCC but it works for me
> now.
>
> One question: Is there a way I can implement this in the grammar file
> without having to manually add it after the *.java files have been
> generated?
Hmm, I can only make very general comments, because I don't know
exactly what problem you are trying to solve.
If you want to customize these routines in the generated *.java files,
one option is to edit the template files that are used to generate
them. Those files are in the freecc.jar file, though also under
src/templates/java/* in the SVN repository. Basically, if you put a
xxx.ftl file of the same name in the same directory as your grammar
file, that will be used instead of the default one in the freecc.jar
file.
Though, that said, editing the templates is something you would do if
the more normal disposition of the code injections didn't cut it for
some reason. I mean, there are obvious issues in terms of the
templates evolving as new freecc releases come out etcetera... Still,
one advantage of the template-based system is that you can edit the
templates in a pinch, even if it's a bit of a last resort.
>
> I use 'INJECT' for other stuff but can't see how that can help in this
> case and it's not really a big deal since the grammar file does not
> change often but I know that you are a purist when it comes to
> this :-)
Well, I don't think it's some kind of ivory tower "purism" for its own
sake. There are very real pragmatic reasons to think that a situation
where you are post-editing generated files is quite problematic. But,
I'm sure you understand that... :-)
>
> Super-thanks again (and I was completely on your side concerning the
> raging JavaCC mail list exchanges that caused you to create the FreeCC
> project last year),
Well, thanks. :-)
Very odd thing all that episode. What I still cannot fathom about it
is that people would behave as they do when there is absolutely
nothing of any real world value at stake. But then that there would be
people who would support the existing project maintainers, who
obviously have never done anything withJavaCC in its entire history as
an OSS project, and were busy trying to demonize the one person who
had ever showed with any gumption to do anything. There, my
understanding of it is that people are conditioned to support the
people that they perceive as the relevant "authority figures" in that
setting -- and they perceived the JavaCC project maintainers as the
authority figures (whose asses must be licked etc.) But again, the
typical corporate yes-man personality does this (one thinks) because
there is something in it for him. To behave the way these people do
when there is absolutely nothing of any real-world value at stake...
nothing to be gained... that is still rather puzzling to me... I guess
that when people have been socially conditioned to behave this way,
they behave this way even when there is no actual practical reason to
do so.
Well, I found the whole thing rather unsettling. The utter hostility
of some of these people towards me. I was reminded of the Milos Forman
film Amadeus, in which Salieri hates Mozart for being so much more
talented than he, and plots the man's destruction. However, I am quite
aware that I am no Mozart. I am at best a Salieri. So what are those
people? I found my public and private interactions with these people
to be a tad scary or sinister perhaps...
JR
>
> Stephen
>
> --
>
http://www.linkedin.com/in/stephencraigevans
> >
>