How to write a parser in C?

Given a MAKEFILE design the data structure that a parser would create and then write code that iterates over that data structure executing commands if needed?

  • Answer:

    MAKEFILE is used when compiling large CPP projects for faster compilation. When you change a single file, only this file can be recompiled instead of everything. It comprises of 3 components: target, dependencies and system commands. Based on a time stamp the compiler recompiles the target. If in case one of its dependencies is also a target, and has a more recent time stamp, this dependency is recompiled before the actual target specified as the first argument. Therefore if you consider this as a tree and each node has its children as its dependencies, then a post order traversal will accomplish our task. While traversing each node the corresponding dependency can be recompiled if its time stamp is higher than its parent.

community wiki at wiki.answers.com Visit the source

Was this solution helpful to you?

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.