none
Deleted RRS feed

Answers

  • You cannot use regular expressions for something like that. You must use syntactic and semantic processing technologies. There are many books; look for books about compiler design. One of the most respected is nicknamed Dragon Book because it has a dragon on its cover. There seem to be two versions, as listed in Dragon Book - Wikipedia. I do not know which is best; you can do your own research. Okay, I wil look at my bookshelf. I have the first edition of Compilers: Principles, Techniques, and Tools but I have not read it.

    Alternatively you can use software developed by many before you. The most common are Lex for syntax and YACC for semantics. They are capable of generating C source code to do whatever scanning and semantic analysis that you describe as input. The source code is typically used in another application that does the compiling. The public-domain versions of them are flex for Lex and Bison for YACC.

    I think I hear some rumbling in the room. Are you trying to tell me you do not know C and C++? Well see the following.

    They generate C# code. I hope you are able to figure out how to use them, I did not.

    In case you do know C++ see my Flex page.

    I know that Microsoft has at least one sample C# compiler available somewhere but I do not know where.

    The following are more references from my bookmarks.

    If you want a book to help learn Lex/Flex and YACC/Bison then if you can get the book Brinch Hansen on Pascal Compilers then people say it is a good introduction to Lex and YACC. It is out of print and probably costs at least $40 used.



    Sam Hobbs
    SimpleSamples.Info

    Wednesday, July 24, 2019 7:31 AM