Files
carbon-lang/executable_semantics/main.cpp
T
Jeremy G. Siek bf6bb800c4 improve abstraction for AssocList, fix bug in optional else (#315)
* improve abstraction for AssocList, fix bug in optional else

* add flag for tracing output, clean up code for output

* turned off tracing by default, updated goldens, removed two examples that use pointers, shouldn't have been there yet
2021-03-01 10:00:02 -05:00

33 lines
828 B
C++

// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include "executable_semantics/syntax_helpers.h"
extern FILE* yyin;
extern auto yyparse() -> int; // NOLINT(readability-identifier-naming)
int main(int argc, char* argv[]) {
// yydebug = 1;
if (argc > 1) {
Carbon::input_filename = argv[1];
yyin = fopen(argv[1], "r");
if (yyin == nullptr) {
std::cerr << "Error opening '" << argv[1] << "': " << strerror(errno)
<< std::endl;
return 1;
}
}
if (argc > 2 && argv[2] == std::string("-trace")) {
Carbon::tracing_output = true;
}
return yyparse();
}