What is the best way to get a C# subset semantic/syntactic parser

SyntaxEditor for Windows Forms Forum

Posted 8 years ago by John Groenland - CTO, mcThings Inc
Version: 16.1.0330
Avatar

I need to write a compiler for a language that will be a subset of C# and will be used on an embedded device. Our current compiler is a VB.NET subset and the semantic parser is hard-coded. It is a small subset and we don't require features like try/catch, checked/unchecked, lock, using, struct, async, attributes, pre-processing, etc., but it must include inheritance, interfaces, generics and the more common c# stuff. We also will change from windows forms to WPF but that should not have much of an impact.
My main question is what is the best way to write/buy/copy a semantic parser. Currently I came up with 3 alternatives but maybe there are more..

  • Writing the grammar from scratch which is a lot of work.
  • Buying the .Net Languages add-on source and start from there.
  • Create the AST in code by changing my existing VB code parser.

Thanks

Comments (2)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi John,

Especially if you are planning on moving to WPF, I would recommend getting licenses for the WPF SyntaxEditor and its .NET Languages Add-on.  Its .NET Languages Add-on is better designed and more advanced than the older WinForms one.  Then also getting a Blueprint license for the .NET Languages Add-on there.  You can modify its CSharpGrammar source file to remove bits and pieces of grammar from our default implementation that is built to normal C# standards.  And as long as you do that, everything else should still work.  You also can remove some keywords from the lexer while you're at it, like "try" and "catch".


Actipro Software Support

Posted 8 years ago by John Groenland - CTO, mcThings Inc
Avatar

Thanks for the reply. I will discuss it internally.

The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.