[antlr-interest] ANTLR generated C (not C++), anyone??

Ric Klaren klaren at cs.utwente.nl
Wed Jul 21 08:15:59 PDT 2004


Hi,

On Wed, Jul 21, 2004 at 07:46:32AM -0700, Bryan Ewbank wrote:
> I'm evaluating ANTLR as a replacement for lex, yacc, and several
> thousand lines of source code in a legacy system.  The key problem is
> that ANTLR generates C++ code - not C - and there doesn't seem to be
> a clear way for C to interface neatly with C++.

It will probably be a horror to try and do that.

> So, is anyone working on (or know of work on) an ANTLR that generates
> POCC (plain old C code) for us poor folks that have substantial
> embedded bases?

ANTLR 3 will probably support C as target language (Terence mentioned using
plain C as a target to verify codegen for non exception supporting
langauges). ANTLR 3 will probably not see daylight till end this year
though.

> Please don't suggest recompiling everything with G++; it simply won't
> happen in my lifetime due to the hackish nature of the code, as well
> as the possibility of increasingly complex code.

I'll do the other evil ;) Write a codegenerator for C in ANTLR 2 ;) But
seriously if you have the time and wager on antlr 3 coming out this year
then it's probably an option. If you want to spent time/effort it can be an
option to write a minimalistic codegenerator/support lib for C. It also
depends a bit on what kindoff lex/yacc features (lexer states and such) you
use wether switching to ANTLR is easy or difficult. Another important
factor is the language you want to parse. Some things are a little bit
harder (or less efficient) to tackle in a LL(k) world.

I guess I'd try and see if converting the grammar to antlr would be
feasible and then decide on which way to go. But I guess there's easier
solutions out there (PCCTS maybe (think it targetted C too)?).

Cheers,

Ric
--
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893755  ----
-----+++++*****************************************************+++++++++-------
  "I think we better split up."
  "Good idea. We can do more damage that way."
  --- Ghostbusters



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list