![]() This relies on the program stack to use recursion not only to provide the ordering for the grammar rules, but to do depth first processing so that intermediate results are stored on the stack in the callers' program stack frames.Į.g. When parsing is complete, this array is traversed, and a third mutable array is used to process each token in order, pushing number tokens, and popping numbers for operations and pushing results.Ī third implementation could eliminate the use of a stack by having operations return numbers which are the result of applying operations or converting a number lexeme. #import int main ( void ) Īnother implementation of plus, is that there is a second instance of a mutableArray that stores NSString tokens, and 'plus' simply pushes a '+' NSString token onto this second array.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |