0

I want to know Is there any compiler-compiler library that is written in C# or Not ?

I know Antlr & JavaCC but these library wrote in Java

Is there any library like antlr but in C# (or ported in C#) and open source or not ?

Can anybody introduce them ?

HamedFathi
  • 3,667
  • 5
  • 32
  • 72
  • 1
    What target language are you trying to compile to? Why is it important it is written in C# - surely you just care that it is usable by C#? What are you trying to achieve? – RB. May 05 '16 at 14:56
  • This isn't exactly what you want, but it'll head you off in the right direction: http://www.codeproject.com/Articles/220042/Easily-Create-Your-Own-Parser. I wrote this a while ago in C#, but haven't updated it in a while. – Icemanind May 05 '16 at 14:59
  • I need a lexer/parser for generate any syntax like antlr but with antlr I need java and antlr.jar and I dont want this I want a lexer/parser pure in C# – HamedFathi May 05 '16 at 14:59
  • 1
    ANTLR 4 C# port does not require Java - see [here](https://github.com/tunnelvisionlabs/antlr4cs). Not even the compilation requires Java - it just speeds up the process. – a-ctor May 05 '16 at 15:02
  • @Widi I know about that Sam used IKVM for that so that is not Pure C# already – HamedFathi May 05 '16 at 15:07
  • @Hamed The C# target for ANTLR 4 requires Java (or IKVM) for compiling applications. The resulting compiled C# applications will **not** require Java (or IKVM) to be installed. (source: [here](https://github.com/tunnelvisionlabs/antlr4cs/blob/7cfe2ff7188e9c85e66f0f2b664840af64272268/Readme.md)) – a-ctor May 05 '16 at 15:14
  • Wikipedia has an extensive list of Compiler-compilers: https://en.wikipedia.org/wiki/Compiler-compiler Your answer is probably in the wikipedial list of parser generators: https://en.wikipedia.org/wiki/Comparison_of_parser_generators – Ira Baxter May 05 '16 at 15:54
  • @IraBaxter a parser generator is a form of compiler-compiler. So ANTLR would fit this category. At least thats what your first link told me. – a-ctor May 05 '16 at 15:58
  • @Widi: I agree, which I why I supplied the link to comparison of parser generators. Sure enough, ANTLR is in that list. – Ira Baxter May 05 '16 at 16:14

2 Answers2

0

The C# compiler is itself written in C#, and with Roslyn, this has been made open source.

https://github.com/dotnet/roslyn

There is also a C# port of JavaCC, however, it's no longer maintained. The author switched to Irony instead. If you're just looking for code for examples, it would do that.

https://github.com/deveel/csharpcc

Erik Funkenbusch
  • 92,674
  • 28
  • 195
  • 291
  • Roslyn Can create any lexer and parser for me ? like antlr ? or this a lexer and parser for C# only ? I need to create any Lexer and Parser for any syntax – HamedFathi May 05 '16 at 14:57
  • 1
    @Hamed - you didn't ask for a lexer written in C#, you asked if there were any compilers written in C#. I don't really see the point in writing a new one when there already exist several out there, even if they're not in C# – Erik Funkenbusch May 05 '16 at 15:00
  • I asked !!! https://en.wikipedia.org/wiki/Compiler-compiler , I asked Is there any compiler-compiler library in C# or NOT ? and I mentioned two examples Antlr and JavaCC – HamedFathi May 05 '16 at 15:06
  • @Hamed - sorry, I read that as a compiler and/or compiler library. – Erik Funkenbusch May 05 '16 at 15:11
  • @ErikFunkenbusch: You answered the question, and then voted to close it as off topic? Really?? – Ira Baxter May 05 '16 at 15:55
0

There is Irony. I've never used it myself though.

edeboursetty
  • 5,669
  • 2
  • 40
  • 67