Declaration of the Interpreter_Exercise() function as used in the Interpreter Pattern. More...
Go to the source code of this file.
Macros | |
#define | __INTERPRETER_EXERCISE_H__ |
Functions | |
void | Interpreter_Exercise (void) |
Example of using the Interpreter Pattern. | |
Declaration of the Interpreter_Exercise() function as used in the Interpreter Pattern.
Definition in file c/Interpreter_Exercise.h.
#define __INTERPRETER_EXERCISE_H__ |
Definition at line 9 of file c/Interpreter_Exercise.h.
void Interpreter_Exercise | ( | void | ) |
Example of using the Interpreter Pattern.
The interpreter is instantiated then fed a series of arrays containing integer tokens. Each token represents a single word or punctuation mark. The interpreter converts that array of tokens to an actual sentence by interpreting the meaning of the tokens.
This is a very simple interpreter that handles the first token in a special way and supports punctuation. It is an example of a linear interpreter where tokens can appear in any order (it's up to the creator of the token list to make sure the outcome makes any sense).
The output shows the token list followed by the sentence produced from the tokens.
Definition at line 124 of file Interpreter_Exercise.c.
References _sentenceTokenLists, _TokensToString(), DynamicString_Clear(), Interpreter_Interpret(), and DynamicString::string.