diff --git a/ci/build-and-test.sh b/ci/build-and-test.sh index f93d817..643b857 100755 --- a/ci/build-and-test.sh +++ b/ci/build-and-test.sh @@ -24,4 +24,4 @@ cmake -S $SRC_DIR -B $BUILD_DIR -DCMAKE_C_COMPILER=$C_COMPILER -DCMAKE_CXX_COMPI cmake --build $BUILD_DIR || exit $? ctest || exit $? -$BUILD_DIR/bin/dumblang || exit $? # Just check that it runs +$BUILD_DIR/bin/dumblang ../../../examples/example.dumb || exit $? # Just check that it runs diff --git a/examples/example.dumb b/examples/example.dumb new file mode 100644 index 0000000..5de9813 --- /dev/null +++ b/examples/example.dumb @@ -0,0 +1,2 @@ +let x = 42 +let y = x + 3 \ No newline at end of file diff --git a/src/dumblang/main.cpp b/src/dumblang/main.cpp index 1288ee9..6645c3e 100644 --- a/src/dumblang/main.cpp +++ b/src/dumblang/main.cpp @@ -1,11 +1,37 @@ -#include "lexer.h" +#include "parser.h" +#include +#include +#include #include -int main() +int main(int argc, char *argv[]) { - std::stringstream ss1{"let x = 0\nlet y = 1"}; - lexer::print_tokens(lexer::lex(ss1)); - std::stringstream ss2; - lexer::print_tokens(lexer::lex(ss2)); + // TODO Use CLI library. Clipp is unmaintained, find another one + if (argc != 2) + { + std::cerr << "USAGE: " << argv[0] << "