Main.cpp
上传用户:afrynkmhm
上传日期:2007-01-06
资源大小:1262k
文件大小:1k
- #include <iostream>
- #include "LangLexer.hpp"
- #include "LangParser.hpp"
- #include "LangWalker.hpp"
- int main()
- {
- ANTLR_USING_NAMESPACE(std)
- ANTLR_USING_NAMESPACE(antlr)
- try {
- LangLexer lexer(cin);
- LangParser parser(lexer);
- parser.block();
- // antlr.CommonAST a = (antlr.CommonAST)parser.getAST();
- RefAST a = parser.getAST();
- cout << a->toStringList() << endl;
- LangWalker walker;
- walker.block(a); // walk tree
- cout << "done walking" << endl;
- } catch(exception& e) {
- cout << "exception: "<< e.what() << endl;
- }
- }