#ifndef SIMPLEGRAMMAR_H #define SIMPLEGRAMMAR_H ///////////////////////////////////////////////////////////////// // simpleGrammar.h - C++ grammar detectors // // ver 1.1 // // Language: Visual C++, ver 7.1 // // Platform: Dell Dimension 8300, Windows XP Prof, SP 2 // // Application: CSE687 prototype for project #1, Spring 2005 // // Author: Jim Fawcett, CST 2-187, Syracuse University // // (315) 443-3948, jfawcett@twcny.rr.com // ///////////////////////////////////////////////////////////////// /* * Module Operations * ----------------- * Grammar provides a set of detectors for various C++ constructs. * This set is far from complete, but enough to get project work * started. * * Public Interface * ---------------- * istringstream in("set of tokens"); * SimpleToker toker(in); // construct with any stream * SimpleSemiExp semi(toker); // pass toker to semi object * while(semi.good()) // good tests stream state * { * semi.get(); // extracts sequence of tokens * Grammar gr(semi); // pass semi-expression to gr * if(gr.isFunctionDet) // a function definition? * // do something * if(gr.isClass) // a class declaration? * // do something * if(gr.isDataDecl) // a type declaration? * // do something * } * */ /* Build Process * ------------- * Required Files: * SimpleGrammar.h, SimpleGrammar.cpp, * SimpleSemiExp.h, SimpleSemiExp.cpp, * SimpleToker.h, SimpleToker.cpp * Compile Command: * cl /DTEST_SIMPLEGRAMMAR SimpleGrammar.cpp SimpleSemiExp.cpp\ * SimpleToker.cpp * * Maintenance History * ------------------- * ver 1.1 : 04 Feb 05 * - inserted check for zero length semi-expression in test stub. * ver 1.0 : 23 Jan 05 * - first release * */ // #include "..\\SimpleSemiExp\\SimpleSemiExp.h" class SimpleGrammar { public: SimpleGrammar(const SimpleSemiExp &se); bool isClass() const; bool isFunctionDef() const; bool isObjectDecl() const; // does not do anything yet private: SimpleSemiExp se_; }; #endif