My goal is to make C. syntax very simple and simple. (Not a complete compiler, but just a basic program that takes the source code as "Enter" and prints the code that displays errors). I want to use C ++ as the language for this.
Can someone guide me to write a regex in 'C ++' for the following:
Any details / suggestions / recommendations will be further appreciated.
I do not think that you can Conly parse using regular expressions. You will need to start learning lexers, parsers, grammar, etc.
C
: - .
C grammars yacc/lex.
yacc
lex
C , . , , http://www.gnu.org/software/bison/, "" ++, .
clang. GitHub.
clang
To recognize C operators, lexical analysis is not enough, because lexers work at the character level. In addition to the C lexer, you need a C parser that will parse the source code. LRSTAR Parser Generator provides a C project to help you get started.