Mind guys if you could help me on creating this program(regards with file handling).
starting with this:

for instance. i have a .txt file that contains these:

lexeme               token

main            - Identifier
(               - Open Parenthesis
)               - Close Parenthesis
{               - Open Curly Bracket
printf          - Keyword
(               - Open Parenthesis
"Hello world!"  - Inside Argument   
)               - Close Parenthesis
;               - Delimeter
}               - Close Curly Bracket

This is called "symbol table"

So basically, when this is on code form, it would be this:

main()
{
printf("Hello world!");
}

So, i need create a program that will interpret the source code (obviously the input/output, logical. like 1+1, then it would just output the '2') using the symbol table.

So, i need create a program that will interpret the source code (obviously the input/output, logical. like 1+1, then it would just output the '2') using the symbol table.

So...you want to write a compiler. If the symbol table is already generated, that simplifies your job, but not a great deal. Tokenizing is one of the easier steps in compilation. The next step, parsing, is where the real fugliness comes in when it comes to the C language, because you can't just use a simple recursive descent parser due to C's complex grammar.

This isn't a problem for a forum post, so I'll direct you to a list of resources.

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.