source: translator/Parser.old/Parser.cc @ 91b216b4

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change on this file since 91b216b4 was 51b7345, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

initial commit

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[51b7345]1/*
2 * This file is part of the Cforall project
3 *
4 * $Id: Parser.cc,v 1.6 2002/11/15 20:07:18 rcbilson Exp $
5 *
6 */
7
8#include "Parser.h"
9#include "TypedefTable.h"
10#include "lex.h"
11#include "cfa.tab.h"
12
13/* global variables in cfa.y */
14extern int yyparse(void);
15
16extern int yydebug;
17extern LinkageSpec::Type linkage;
18
19extern TypedefTable typedefTable;
20extern DeclarationNode *theTree;
21/* end of globals */
22
23Parser *Parser::theParser = 0;
24
25Parser::Parser(): parseTree( 0 ), parseStatus( 1 ) {}
26
27Parser::~Parser()
28{
29  delete parseTree;
30}
31
32/* static class method */
33Parser &
34Parser::get_parser()
35{
36  if( theParser == 0 ) {
37    theParser = new Parser;
38  }
39  return *theParser;
40}
41
42void 
43Parser::parse( FILE *input )
44{
45  extern FILE *yyin;
46  yyin = input;
47  extern int yylineno;
48  yylineno = 1;
49  typedefTable.enterScope();
50  parseStatus = yyparse();
51  parseTree = theTree;
52}
53
54void
55Parser::set_debug( bool debug )
56{
57  yydebug = debug;
58}
59
60void 
61Parser::set_linkage( LinkageSpec::Type linkage )
62{
63  ::linkage = linkage;
64}
65
66
67void 
68Parser::freeTree()
69{
70  delete parseTree;
71  parseTree = 0;
72}
73
Note: See TracBrowser for help on using the repository browser.