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/
build/
lib/
# Prerequisites
*.d

View File

@@ -6,5 +6,8 @@
"listeners": true,
"visitors": true,
"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
#define FIVE 5
#endif
#pragma once
#define FOO 1

View File

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