Add basic error handling

This commit is contained in:
2020-09-30 01:15:57 +05:30
parent eb99588600
commit e2a1b493f6
5 changed files with 19 additions and 8 deletions

2
.gitignore vendored
View File

@@ -1,6 +1,6 @@
.antlr/ .antlr/
build/ build/
lib/
# Prerequisites # Prerequisites
*.d *.d

View File

@@ -6,5 +6,8 @@
"listeners": true, "listeners": true,
"visitors": true, "visitors": true,
"outputDir": "../lib/generated" "outputDir": "../lib/generated"
},
"files.associations": {
"ostream": "cpp"
} }
} }

9
README.md Normal file
View File

@@ -0,0 +1,9 @@
# bfc
An extension of a language that shall not be named
## Setup oddities
1. Copy antlr4's cpp libs to `./libs/antlr4`.
2. Copy `antlr-4.8-complete.jar` to `./thirdparty/antlr`.
3. Generate parsers to `./libs/generated` or use VSCode with the ANTLR extension.

View File

@@ -1,3 +1,3 @@
#ifndef __MAIN_HPP #pragma once
#define FIVE 5
#endif #define FOO 1

View File

@@ -41,11 +41,10 @@ public:
int main(int argc, const char *argv[]) int main(int argc, const char *argv[])
{ {
// std::cout<<"Hello World "<<FIVE<<std::endl;
std::ifstream stream; std::ifstream stream;
try{
stream.open(argv[1]); stream.open(argv[1]);
}catch(std::exception e){ if(stream.fail()){
std::cout<<"Could not open"<<std::endl; std::cout<<"Could not open"<<std::endl;
return 1; return 1;
} }