Compiler in C# (.NET)

  • Thread starter Thread starter Pawel
  • Start date Start date
P

Pawel

Hi.

Hello, i want doing simple compiler in C# (.NET).
I have lexer and parse file. What kind of tools should I use? And what to
do??

Thanks!
pawel
 
Not sure I understand the question fully, but if you just want to compile C#
code, "csc" is the C# compiler and is part of the .NET framework (SDK maybe)
(it is not dependent on VisualStudio etc)... just search on your HDD for csc
and try csc /?


Alternatively - MSDN to the rescue:
http://msdn2.microsoft.com/en-us/library/2fdbz5xd.aspx and
http://msdn2.microsoft.com/en-us/library/78f4aasd.aspx

(apparently the path is set correctly to use CSC if you use the .NET
Framework SDK Command Prompt)

Easier option, though, is to grab e.g. an Express Edition and use that!

Marc
 
Pawel said:
Hi.

Hello, i want doing simple compiler in C# (.NET).
I have lexer and parse file. What kind of tools should I use? And what to
do??

Try the comp.compilers newsgroup.

Try http://groups.google.com/advanced_search with C# as the text search
and comp.compilers as the target newsgroup. Plenty of interesting hits
occur.

http://www.mono-project.com/CSharp_Compiler is of interest after skimming
through the google search hits. http://www.mono-project.com/Compiling_Mono
states:

"This document describes how to compile and install Mono from its source
code, the source code is available from our download page. ..."

Hmm. Why do you want to re-invent the wheel? Why not dig into the mono
project if you want to get under the hood of a C# compiler? (Rhetorical
questions.)

Doug
 
Pawel,

Here is one free compiler generator.
http://www.ssw.uni-linz.ac.at/Research/Projects/Coco/

It has a version that generates c# code as well as it comes with sample
grammar file for the c# language.

I kind of dislike that they use recursive descent method (I'd rather prefer
LALR or some other LR(k)) parser, but this is the best free one that I've
found so far.

I'll appreciate if someone else in the group that knows other parser
generator tools that generates c# post some links.
 
Stoitcho said:
Pawel,

Here is one free compiler generator.
http://www.ssw.uni-linz.ac.at/Research/Projects/Coco/

It has a version that generates c# code as well as it comes with sample
grammar file for the c# language.

I kind of dislike that they use recursive descent method (I'd rather prefer
LALR or some other LR(k)) parser, but this is the best free one that I've
found so far.

I'll appreciate if someone else in the group that knows other parser
generator tools that generates c# post some links.

I have managed to adapt flex/bison output for use in C# quite easily. I
am using it for over three years now and it works just fine, not
requiring you to use any extra runtime libraries (like ANTLR etc.). I'll
try to put it together and post it soon. Just watch my sourceforge
project at http://sourceforge.net/projects/nscript

(I know nothing is there yet, but I promise it's in the works, I just
haven't had too much time/mood lately)

Stefan
 
Stefan,

That would be great.
I believe the whole community can benefit from it

Thanks
Stoitcho Goutsev (100) [C# MVP]
 
Stefan said:
I have managed to adapt flex/bison output for use in C# quite easily. I
am using it for over three years now and it works just fine, not
requiring you to use any extra runtime libraries (like ANTLR etc.). I'll
try to put it together and post it soon. Just watch my sourceforge
project at http://sourceforge.net/projects/nscript

Great. That's one thing I disliked about ANTLR.
 
Back
Top