[ACCEPTED]-Lex/Yacc for C#?-yacc

Accepted answer
Score: 15

I've done a couple of small projects with 13 GPLEX/GPPG, which are pretty straightforward 12 reimplementations of LEX/YACC in C#. I've 11 not used any of the other tools above, so 10 I can't really compare them, but these worked 9 fine.

GPPG can be found here and GPLEX here.

That 8 being said, I agree, a full LEX/YACC solution 7 probably is overkill for your problem. I 6 would suggest generating a set of bindings 5 using IronPython: it interfaces easily with 4 .NET code, non-programmers seem to find 3 the basic syntax fairly usable, and it gives 2 you a lot of flexibility/power if you choose 1 to use it.

Score: 11

I'm not sure Lex/Yacc will be of any help. You'll 4 just need a basic tokenizer and an interpreter 3 which are faster to write by hand. If you're 2 still into parsing route see Irony.

As a sidenote: have 1 you considered PowerShell and its commandlets?

Score: 11

Also look at Antlr, which has C# support.

0

Score: 5

Still early CTP so can't be used in production 1 apps but you may be interested in Oslo/MGrammar: http://msdn.microsoft.com/en-us/oslo/

Score: 4

Jison is getting a lot of traction recently. It 5 is a Bison port to javascript. Because 4 of it's extremely simple nature, I've ported 3 the jison parsing/lexing template to php, and 2 now to C#. It is still very new, but if 1 you get a chance, take a look at it here: https://github.com/robertleeplummerjr/jison/tree/master/ports/csharp/Jison

Score: 3

If you don't fear alpha software and want 6 an alternative to Lex / Yacc for creating 5 your own languages, you might look into 4 Oslo. I would recommend you to sit through session 3 recordings of sessions TL27 and TL31 from 2 last years PDC. TL31 directly addresses the creation of 1 Domain Specific Languages using Oslo.

Score: 3

Coco/R is a compiler generator with a .NET 4 implementation. You could try that out, but 3 I'm not sure if getting such a library to 2 work would be faster than writing your own 1 tokenizer.

http://www.ssw.uni-linz.ac.at/Research/Projects/Coco/

Score: 3

I would suggest csflex - C# port of flex - most 1 famous unix scanner generator.

Score: 3

I believe that lex/yacc are in one of the 2 SDKs already (i.e. RTM). Either Windows 1 or .NET Framework SDK.

Score: 3

Gardens Point Parser Generator here provides 3 Yacc/Bison functionality for C#. It can 2 be donwloaded here. A usefull example using 1 GPPG is provided here

Score: 1

As Anton said, PowerShell is probably the 2 way to go. If you do want a lex/ yacc implementation 1 then Malcolm Crowe has a good set.

Edit: Direct Link to the Compiler Tools

Score: 1

Just for the record, implementation of lexer 4 and LALR parser in C# for C#:

http://code.google.com/p/naive-language-tools/

It should be 3 similar in use to Lex/Yacc, however those 2 tools (NLT) are not generators! Thus, forget 1 about speed.

More Related questions