|
-
Mar 15th, 2008, 01:55 PM
#1
Thread Starter
New Member
Lexical? Simple Compiler for my Project
can anyone help me with my School project..since
My Teacher told me to make a simple basic compiler that has lexical analysis features
so it means onc you type an expression on a textbox..and verify that line
it will separate Identifier,operator,assignment operator and number
so lets say you type sum=a+b
then on the ListBox it will show
sum is an identifier
= is an Assignment Operator
a is an identifier
+ is an Operator
b is an identifier
just like that and if i inputted sum = 1 + 2 then it will show
sum is an identifier
= is an Assignment Operator
1 is a number
+ is an Operator
2 is a number
after that on the second listbox it will show
Sum = 3 (since 1+2 is inputted on the textbox)
I hope someone could help me and provide the easiest code as possible
-
Mar 21st, 2008, 05:47 AM
#2
Re: Lexical? Simple Compiler for my Project
Noone here will do your homework for you. A quick look around the forums will show you that. But if you get started, and then run into problems, you can post your code in the relevant forum and you are pretty much guaranteed help by the many qualified people here.
BUT DON'T ASK US TO DO YOUR HOMEWORK.
-
Mar 21st, 2008, 05:19 PM
#3
PowerPoster
Re: Lexical? Simple Compiler for my Project
 Originally Posted by leiza11
can anyone help me with my School project..since
My Teacher told me to make a simple basic compiler that has lexical analysis features
so it means onc you type an expression on a textbox..and verify that line
it will separate Identifier,operator,assignment operator and number
so lets say you type sum=a+b
then on the ListBox it will show
sum is an identifier
= is an Assignment Operator
a is an identifier
+ is an Operator
b is an identifier
just like that and if i inputted sum = 1 + 2 then it will show
sum is an identifier
= is an Assignment Operator
1 is a number
+ is an Operator
2 is a number
after that on the second listbox it will show
Sum = 3 (since 1+2 is inputted on the textbox)
I hope someone could help me and provide the easiest code as possible
first o must separate the things... how!?! well you can try this way:
you can do a loop, in these loop you must see the letters(and simbols) is like you have a string and you shearch the words(you can do these by using mid, left and right string functions(or one of them).... for you see the type of a varible(i don't have sure) but use the typename function...
i hope that i give some lights
-
Mar 21st, 2008, 05:22 PM
#4
PowerPoster
Re: Lexical? Simple Compiler for my Project
 Originally Posted by leiza11
can anyone help me with my School project..since
My Teacher told me to make a simple basic compiler that has lexical analysis features
so it means onc you type an expression on a textbox..and verify that line
it will separate Identifier,operator,assignment operator and number
so lets say you type sum=a+b
then on the ListBox it will show
sum is an identifier
= is an Assignment Operator
a is an identifier
+ is an Operator
b is an identifier
just like that and if i inputted sum = 1 + 2 then it will show
sum is an identifier
= is an Assignment Operator
1 is a number
+ is an Operator
2 is a number
after that on the second listbox it will show
Sum = 3 (since 1+2 is inputted on the textbox)
I hope someone could help me and provide the easiest code as possible
you can shearch caracter after caracter(like using left string function, for example)... using these you can separate the things....
i hope these words give you some lights
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|