0

I need to convert simple rules I write into a .net assembly. The rules are very simple in syntax. Its a bunch of if-then statements with the following structure:

if <conditions> then <return-string>

I've already made a program which does the necessary however, since the conditions may become complex and new operations be added/removed, I was suggested to use antlr for the purpose.

I usually use System.CodeDom for the purpose of creating the equivalent c# code, after parsing the input rule text. I do this by maintaining some sort of state in my parser program by which I identify the token is a variable, keyword, operation, or data, and form the correct CodeExpression object.

I've seen a few of antlr tutorials, but they all show a parser implementation. Is that what I want? Or a simple lexer?

If its a lexer what is the framework I have to work with. What would I have to be doing in my c# program to handle those parser states like I was earlier doing it...?

deostroll
  • 11,661
  • 21
  • 90
  • 161
  • 1
    Read http://stackoverflow.com/questions/2842809/lexers-vs-parsers Short version: a lexer divides the input into tokens, a parser gives those tokens some meaning. You need a parser. – Brian O''Byrne Jun 07 '13 at 13:58
  • Most parser examples I've seen, like simple calculator, evaluate and display the input. I want to build a CodeDom expression object...how to do that? – deostroll Jun 08 '13 at 01:34

0 Answers0