Friday, 9 August 2013

Looking for C90 Grammar compatible with ANTLR 4 or MPlex/MPPG

Looking for C90 Grammar compatible with ANTLR 4 or MPlex/MPPG

I wrote a C90 cross-compiler in C# for a friend's custom CPU which
produces a text file containg assembly language. I then feed this to an
assembler he wrote in Python, which produces a text file containing
machine code. We then transmit this to his machine via a serial
connection, and at this point his custom CPU runs the program.
I would like to bundle this whole process into something as simple as
pressing the 'compile' button, as you would do in any modern IDE. Also,
speaking of modern IDE's, it would be nice to develop our C code in
something other than Notepad and enjoy some of the amenities these modern
IDE's have to offer such as file management, in-place compilation, syntax
highlighting, and intelli-sense.
Now, I use Visual Studio for most of my development so I am well aware
that it already comes bundled with a C/C++ compiler. It would be really
nice to be able to use Visual C++ to develop C code for our custom CPU and
override it's 'compile' feature so that it invokes my compiler tool-chain
instead of its C++ compiler.
The problem I envision with this approach is that:
I don't think it's possible to override the 'compile' feature and
the syntax highlighting/intelli-sense will not conform to the C90
standard. I can live with #2 but I would like to know if #1 is possible.
Failing this I would need to bite the bullet and integrate my custom
compiler into Visual Studio and doing so requires that I have a C90
grammar file that's compatible with either ANTLR or MPlex/MPPG so that I
can output a parser/scanner in C# that Visual Studio can use for it's
syntax highlighting/intelli-sense.
The grammar file I see listed on the ANTLR site is C99; does anyone know
of a C90 implementation? http://slps.github.io/zoo/#ANSI_C90 seems to have
one but the grammar is in BGF, EBNF, DMS BNF, and SDF formats that I
believe are not compatible with either of the tools I mentioned. Any help
would be appreciated.

No comments:

Post a Comment