[antlr-interest] Beginner need some help
infal at web.de
Tue Aug 23 18:07:41 PDT 2005
Dear Mr. Christopher Schultz,
many thanks for your answer.
> This is a BIG BIG task, and very difficult. ANTLR can help you parse the
> source code, but you're going to have to write a very complicated
Maybe I'm completely wrong, but I think about ANTLR as a tool
to generate translators from a grammars. C++ grammar is also
present on ANTLR page or "John's PCCTS-based C++ Parser Page".
So maybe it is only necessary to define some lexical rules with actions,
that means only expand a given grammar or generated classes with
user-defined actions. I don't know.
> which knows what type variables are (i.e. for overloading)
> and all kinds of stuff like that.
In one newsgroup message I can read :
"However, I have built a C++ scarfer for somebody that was
able to pick out class members and func defs relatively easily. There's
no short cut for full C++ unfortunately. Soon the World will fall back on another
language (with a sigh) or to a subset (with a snicker). " wroten by Terence J. Parr.
But no future references to this
Maybe You know what this means? This can be very helpfully.
> Why don't you just use CLR's ability to execute compiled C++ code
> directly? I'm not sure of Mono compiles C++, but the MS compiler
> certainly does.
No, not really, It is possible to generate "unchecked" (old common) C++ library
an call functions to that library. But this have for my purposes to much disadvantages.
1. It is only "ok" to call relative simple functions with simple data
2. for complex types we must do complex marshaling (which very slow!)
3. for complex types we must carefully define appropriate types in C# and maybe define proxy-functions in C++ library
4. for point 3 we must also write a INTEROP "calling" Interface (this is like my first question) for each exported C++ function.
At this point it can be very complicated to do this marshaling at all, if we use something like std::list<T> (it is much likely generic List<T>) in C# and can be very time and memory expensive.
5. we have all the disadvantages of C# combined with disadvantages of C++ (i.e. insecure pointers)
6. no callback possibilities (events, actions) from C++ to C# or I don't know how to do it, but in this case it is necessary to rewrite C++
library at all
7. no reasonable debugging possibilities
8. and of course I wish continue developing of the library later without having of C# and C++ mixing.
I think, it is at a starting point a very big task, but can save a lot of time later.
Mit der Gruppen-SMS von WEB.DE FreeMail können Sie eine SMS an alle
Freunde gleichzeitig schicken: http://freemail.web.de/features/?mc=021179
More information about the antlr-interest