0

i need help in my project
i want to identify operators in sentences like this example
o+9=h;
i want it in case
like
case 5:
ch=nextchar();
if(????) _state=5;
else
_state=6;
case 6:
retract();
return(?????????????token.operators);

1
Contributor
1
Reply
2
Views
9 Years
Discussion Span
Last Post by Genuis Man
0

i need help in 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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.