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

Posted 2 years ago by Avatar John Groenland

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.


Comments (2)

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

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 2 years ago by John Groenland

Thanks for the reply. I will discuss it internally.

Information The latest build of this product (2018.1 build 0340) was released 6 months ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.