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.