our project is to make a lexical analyzer. I am using DevCpp and it is in C. I barely know the idea of the analyzer. Can someone please ive me a clue on where to start in this project. I think if I will know where to start, I can have some idea. thanks. :D

Also read up about "Expression Evaluators".

These can be fun to build! Start simply two operands, one operator! then work up!

Processing 3 * 4
is easy
Processing 2 + 3 * 4
Is a bit more complicated.

Processing 2 + 3 * (4 +(99 / 9))
Takes a good expression evaluator.

The next logical step is a script compiler.
a = 4
b = 3
3 + a * b

This will envolve linked lists.

HINT: Read up about RPN (Reverse Polish Notation).
Labels:
You'll separate operators
"+", "-", "/", "*" etc.
You'll separet system functions
"max", "min", etc.
You'll have dynamic constants, etc.

Then you'll build your lists one step at a time.

3 + 4

3    4
   \ /
    +

3 + 4 * 5

 3    4
  \  /
   +

        4   5
         \ /
  3      *
    \   /
     +

>These can be fun to build! Start simply two operands, one operator! then work up!
Definitely not!! If you are building it for educational purposes fine; otherwise it is not recommended to hand code a lexer[1] yourself.

To OP: If you 'project' is whole about building a lexer, the above two posts would do. However if your 'project' needs a lexer, don't go about making one but use lex the lexer code generator. It is a program that reads the formal grammar and generates code for your lexer.
Here is the manual for lex.

[1] lexer: lexical analyzer

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.