views:

60

answers:

1

I'm in the job of writing a compiler which compiles a project-specific DSL (with the features of a basic scripting language) into an project-specific assembler language. The platform is written in C#, so a native .NET-Compiler would be the perfect solution.

I already did a lot of research and it seems ANTLR would fit in the job of building the compiler, in case I understand the following things right:

I have to write the Grammar-File and a "Template" which emits the assembler. The ANTLR-framework (java) generates a Compiler from the grammar file. The Compiler itself is pure C# (by using the Antlr 3 CSharp Target) and can, after compiling to an .NET assembly, compile "my" DSL to our custom assembler.

Am I getting the point? And is there definitively no need for Java / the ANTLR-Java-API at runtime (= when "using" the compiler)? (I'm also open for other solutions/frameworks, as long as the resulting compiler is a .NET component).

Thx :)

+2  A: 

There is detailed information about using the CSHarp target for ANTLR

In summary:

All you need is the C# parser/lexer code that ANTLR generates in addition to a reference to the ntlr3.Runtime.dll.

The dll is a modeled after the Java version but doesn't use or call into anything that is Java.

Matthew Manela
I know the information page about the CSharp target, but as I (yet) don't know much about ANTLR I wantet to make sure I understood everything correctly. Thanks!
Jens Nolte