source: translator/Parser/Parser.cc @ b87a5ed

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 b87a5ed was b87a5ed, checked in by Peter A. Buhr <pabuhr@…>, 9 years ago

licencing: first groups of files

  • Property mode set to 100644
File size: 1.4 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// Parser.cc --
8//
9// Author           : Rodolfo G. Esteves
10// Created On       : Sat May 16 14:54:28 2015
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Sat May 16 14:55:59 2015
13// Update Count     : 2
14//
15
16#include "Parser.h"
17#include "TypedefTable.h"
18#include "lex.h"
19#include "cfa.tab.h"
20
21// global variables in cfa.y
22extern int yyparse(void);
23extern int yydebug;
24extern LinkageSpec::Type linkage;
25extern TypedefTable typedefTable;
26extern DeclarationNode *theTree;
27
28Parser *Parser::theParser = 0;
29
30Parser::Parser(): parseTree( 0 ), parseStatus( 1 ) {}
31
32Parser::~Parser() {
33        delete parseTree;
34}
35
36Parser &Parser::get_parser() {
37        if ( theParser == 0 ) {
38                theParser = new Parser;
39        } // if
40        return *theParser;
41}
42
43void Parser::parse( FILE *input ) {
44        extern FILE *yyin;
45        yyin = input;
46        extern int yylineno;
47        yylineno = 1;
48        typedefTable.enterScope();
49        parseStatus = yyparse();
50        parseTree = theTree;
51}
52
53void Parser::set_debug( bool debug ) {
54        yydebug = debug;
55}
56
57void Parser::set_linkage( LinkageSpec::Type linkage ) {
58        ::linkage = linkage;
59}
60
61void Parser::freeTree() {
62        delete parseTree;
63        parseTree = 0;
64}
65
66// Local Variables: //
67// tab-width: 4 //
68// mode: c++ //
69// compile-command: "make install" //
70// End: //
Note: See TracBrowser for help on using the repository browser.