diff --git a/Readme.md b/Readme.md index 68ef1f7..109943d 100644 --- a/Readme.md +++ b/Readme.md @@ -5,6 +5,7 @@ - better error reporting..for example ls_dir on non existing dir should prind `pwd` dir ### TODO +- add debug support, at least function call could keep call stack - documentation - add url of source/inspiration to clib/*.cpp - add stdtest - to test every functionality @@ -12,7 +13,6 @@ - add -sb option to remove sheebang line - add instrumentation (time, nr of evals, num of atoms, debug info, debug environment etc) - add -p (profile/performance option) -- add debug support function call could keep call stack - multiline editting (kilo editor) - execute system command should capture stderr - add built in for and, or diff --git a/ml.cpp b/ml.cpp index 030fec8..fb2e8af 100644 --- a/ml.cpp +++ b/ml.cpp @@ -1886,6 +1886,12 @@ int main(int argc, char *argv[]) { std::vector files = getCmdOption(argv, argc, "-f"); for (size_t i = 0; i < files.size(); i++) run(read_file_contents(files[i]), env); + // just one parameter - filename + } else if (argc == 2) { + std::string file_content = read_file_contents(argv[1]); + if (file_content.find("#!") == 0) // shebang ? + file_content.erase(0, file_content.find("\n") + 1); // TODO mac osx newline?? + run(file_content, env); // repl } else { repl(env);