Closed egorsmkv closed 9 years ago
And the interesting idea is to import scripts. It is also convenient to use multiple expressions in the statement.
Say what?
I'm not sure I understand the first point about aliases. Can you please explain more?
As for importing, that is planned, but may not be happening that soon. I'd like to get the core language features implemented first.
@tdenniston
For example, I compiled Bish in the folder "A/B/C". Call it from the folder "A" can not, as Bish ask upload script library.
$:~/tmp/A > ./apps/bish-app/bish scripts/test.bish
Failed to open file at src/StdLib.bish
Here you need to specify the full path to the folder where you installed Bish.
const std::string STDLIB_PATH = "src/StdLib.bish";
Ah, got it. Good point. I'll fix that.
Forgot to mention it in the commit message, but bdddf7e should fix this.
Now you can do this (following your example):
BISH_ROOT=/A/B/C apps/bish-app/bish scripts/test.bish
Can you let me know if the issue is resolved?
@tdenniston Does not compile.
g++ -g -O0 -c src/CallGraph.cpp -o obj/CallGraph.o -MMD -MF obj/CallGraph.d -MT obj/CallGraph.o
g++ -g -O0 -c src/IR.cpp -o obj/IR.o -MMD -MF obj/IR.d -MT obj/IR.o
g++ -g -O0 -c src/IRVisitor.cpp -o obj/IRVisitor.o -MMD -MF obj/IRVisitor.d -MT obj/IRVisitor.o
g++ -g -O0 -c src/IRAncestorsPass.cpp -o obj/IRAncestorsPass.o -MMD -MF obj/IRAncestorsPass.d -MT obj/IRAncestorsPass.o
g++ -g -O0 -c src/CodeGen_Bash.cpp -o obj/CodeGen_Bash.o -MMD -MF obj/CodeGen_Bash.d -MT obj/CodeGen_Bash.o
g++ -g -O0 -c src/Parser.cpp -o obj/Parser.o -MMD -MF obj/Parser.d -MT obj/Parser.o
g++ -g -O0 -c src/SymbolTable.cpp -o obj/SymbolTable.o -MMD -MF obj/SymbolTable.d -MT obj/SymbolTable.o
g++ -g -O0 -c src/TypeChecker.cpp -o obj/TypeChecker.o -MMD -MF obj/TypeChecker.d -MT obj/TypeChecker.o
g++ -g -O0 -o bish src/bish.cpp obj/CallGraph.o obj/IR.o obj/IRVisitor.o obj/IRAncestorsPass.o obj/CodeGen_Bash.o obj/Parser.o obj/SymbolTable.o obj/TypeChecker.o
src/bish.cpp: In function ‘std::string get_stdlib_path()’:
src/bish.cpp:44:18: error: ‘PATH_MAX’ was not declared in this scope
char abspath[PATH_MAX];
^
src/bish.cpp:48:31: error: ‘abspath’ was not declared in this scope
root = realpath(root, abspath);
^
src/bish.cpp:52:35: error: ‘abspath’ was not declared in this scope
stdlib = realpath(stdlib, abspath);
^
make: *** [bish] Error 1
Perhaps you misunderstood me. I mean that the variable STDLIB_PATH must point to the folder where the library is located. Without global explanatory variables. Some version of getCurrentDir();
It seems the only way to accomplish that is to hard code the path when bish.cpp
is compiled. This can be done, but then if one moves the bish binary, the hard coded path will no longer be correct. The issue with using a get current directory approach is that the current directory reflects the current working directory, which changes as the user moves around the filesystem.
If you have an idea on how to work around these issues, could you submit a PR with the changes?
For the compile error, can you tell me if adding #include <limits.h>
fixes the issue?
@tdenniston The problem is that I do not know how to program in C ++.
And that if you add a "make install"?
@tdenniston Adding #include <limits.h>
helped.
@tdenniston That's just my opinion, did not help.
egor@book:~ > ./tmp/BISH/bish/bish -r ./tmp/BISH/scripts/examples/print.bish
Failed to open file at src/StdLib.bish
You must set the BISH_ROOT environment variable in this situation. Try the following:
BISH_ROOT=tmp/BISH/bish ./tmp/BISH/bish/bish -r ./tmp/BISH/scripts/examples/print.bish
Alternatively you may specify the standard library path directly, such as:
BISH_STDLIB=tmp/BISH/bish/src/StdLib.bish ./tmp/BISH/bish/bish -r ./tmp/BISH/scripts/examples/print.bish
@tdenniston I tried it. Add them to the ".bashrc", but it did not help. If the program does not see them.
@tdenniston Can not be made so that instead of std::getenv("BISH_STDLIB");
used STDLIB_PATH
?
Ok, the path to StdLib.bish is now hardcoded as an absolute path at compile time. This is done in the Makefile. The BISH_STDLIB environment variable remains as a backup. Please retry your issue and let me know if it is fixed.
@tdenniston Now everything is in order. You can call from anywhere.
Thanks!
When you create an alias is required in the application directory to load the library.
This is awkward. You can fix this?