diff --git a/CMakeLists.txt b/CMakeLists.txt index e513476..d8f87fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,10 +8,8 @@ SET (CMAKE_BUILD_TYPE gdb) SET (CMAKE_C_FLAGS_GDB " -Wall -ggdb") SET (CMAKE_CXX_FLAGS_GDB " -Wall -ggdb") -include_directories(dispatchkit langkit) +include_directories(dispatchkit) -add_subdirectory(langkit bin) add_subdirectory(dispatchkit bin) add_subdirectory(chaiscript bin) -add_subdirectory(chaioop bin) diff --git a/chaiscript/CMakeLists.txt b/chaiscript/CMakeLists.txt index 6bcbaef..8f27a34 100644 --- a/chaiscript/CMakeLists.txt +++ b/chaiscript/CMakeLists.txt @@ -10,7 +10,7 @@ SET (CMAKE_CXX_FLAGS_GDB " -Wall -ggdb") find_package(Boost 1.36.0 COMPONENTS regex unit_test_framework) if(Boost_FOUND) include_directories(${Boost_INCLUDE_DIRS}) - include_directories(../langkit ../dispatchkit) + include_directories(../dispatchkit) add_executable(chaiscript_test main.cpp) target_link_libraries(chaiscript_test ${Boost_LIBRARIES}) @@ -25,3 +25,4 @@ if(Boost_FOUND) endif() + \ No newline at end of file diff --git a/chaiscript/chaiscript_eval.hpp b/chaiscript/chaiscript_eval.hpp index 2491a21..a438692 100644 --- a/chaiscript/chaiscript_eval.hpp +++ b/chaiscript/chaiscript_eval.hpp @@ -78,28 +78,23 @@ namespace chaiscript for (i = node->children.size()-3; ((int)i) >= 0; i -= 2) { if (node->children[i+1]->text == "=") { dispatchkit::Boxed_Value lhs = eval_token(ss, node->children[i]); - if (lhs.is_unknown() || dispatchkit::Bootstrap::type_match(lhs, retval)) { + try { + if (lhs.is_unknown()) + { + retval = dispatch(ss.get_function("clone"), dispatchkit::Param_List_Builder() << retval); + } + dispatchkit::Param_List_Builder plb; + plb << lhs; + plb << retval; try { - if (lhs.is_unknown()) - { - retval = dispatch(ss.get_function("clone"), dispatchkit::Param_List_Builder() << retval); - } - dispatchkit::Param_List_Builder plb; - plb << lhs; - plb << retval; - try { - retval = dispatch(ss.get_function(node->children[i+1]->text), plb); - } - catch(const dispatchkit::dispatch_error &e){ - throw EvalError("Can not find appropriate '" + node->children[i+1]->text + "'", node->children[i+1]); - } + retval = dispatch(ss.get_function(node->children[i+1]->text), plb); } catch(const dispatchkit::dispatch_error &e){ - throw EvalError("Can not clone right hand side of equation", node->children[i+1]); + throw EvalError("Can not find appropriate '" + node->children[i+1]->text + "'", node->children[i+1]); } } - else { - throw EvalError("Mismatched types in equation", node->children[i+1]); + catch(const dispatchkit::dispatch_error &e){ + throw EvalError("Can not clone right hand side of equation", node->children[i+1]); } } else if (node->children[i+1]->text == ":=") { diff --git a/chaiscript/chaiscript_prelude.hpp b/chaiscript/chaiscript_prelude.hpp index 8bc3567..82acaa3 100644 --- a/chaiscript/chaiscript_prelude.hpp +++ b/chaiscript/chaiscript_prelude.hpp @@ -20,6 +20,8 @@ def puts(x) { \n\ def print(x) { \n\ println_string(x.to_string()) \n\ }; \n\ +def max(a, b) { if (a>b) { a } else { b } } \n\ +def min(a, b) { if (a= 2 && call_exists(range, contai } \n\ retval \n\ } \n\ -def max(a, b) { if (a>b) { a } else { b } } \n\ -def min(a, b) { if (a