Compiler Construction

  • Thread starter Thread starter Max
  • Start date Start date
M

Max

I am working in vb.net to devlope a c++ compiler that will read the
whole .cpo file and search for the keywords ,identiferis,opertaors and
others and also check the syntax for the whole code.

SO would any body there to tell about any algorithem which will serach
the whole .cpp file and return me that file into an array (ervry index
of array hold one word.)

sO PLZ HELP mE AS SOON AS POSSIBLE

From myside any information will be regarded.
 
Max said:
I am working in vb.net to devlope a c++ compiler that will read the
whole .cpo file and search for the keywords ,identiferis,opertaors and
others and also check the syntax for the whole code.

SO would any body there to tell about any algorithem which will serach
the whole .cpp file and return me that file into an array (ervry index
of array hold one word.)

sO PLZ HELP mE AS SOON AS POSSIBLE

From myside any information will be regarded.

I think your description here requires two quite different algorithms.

The first, to find all words used in a given text, just split out on any
non-text characters. You can use the Char class in .NET and its various
static methods for checking if a character is a digit, letter, symbol, etc.

If you construct a list of such delimited characters, you can pass this
to String.Split to split an existing strings into words.

However, to "check syntax for the whole code", in this you essentially
have to build a parser that understands C++ syntax. For this solution I
would really like to know why you want to do this.
 
I think your description here requires two quite different algorithms.

The first, to find all words used in a given text, just split out on any
non-text characters. You can use the Char class in .NET and its various
static methods for checking if a character is a digit, letter, symbol, etc..

If you construct a list of such delimited characters, you can pass this
to String.Split to split an existing strings into words.

However, to "check syntax for the whole code", in this you essentially
have to build a parser that understands C++ syntax. For this solution I
would really like to know why you want to do this.

I, too, would like to know why he *urgently* needs to develop a C++
compiler, in VB.NET, and is asking about it on a C# newsgroup.

Jesse
 
I think your description here requires two quite different algorithms.

The first, to find all words used in a given text, just split out on any
non-text characters. You can use the Char class in .NET and its various
static methods for checking if a character is a digit, letter, symbol,
etc.

If you construct a list of such delimited characters, you can pass this
to String.Split to split an existing strings into words.

However, to "check syntax for the whole code", in this you essentially
have to build a parser that understands C++ syntax. For this solution I
would really like to know why you want to do this.
I, too, would like to know why he *urgently* needs to develop a C++
compiler, in VB.NET, and is asking about it on a C# newsgroup.


Sounds like the course "Compiler Construction" to me. I had the exact same
lab exercise when I studied it at university (although the languages
differed). Maybe the OP is running late with his assignments...


/claes
 
Back
Top