-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from sillydan1/feature/cpp-parsers
Feature/cpp parsers
- Loading branch information
Showing
52 changed files
with
1,313 additions
and
1,531 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,10 +19,8 @@ | |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
cmake_minimum_required(VERSION 3.21) | ||
# to generate a changelog, use: (python3 -m pip install git-changelog) | ||
# $ git-changelog -s conventional . -o CHANGELOG.MD | ||
project(expr VERSION 2.2.0) | ||
cmake_minimum_required(VERSION 3.18) | ||
project(expr VERSION 3.0.0) | ||
include(cmake/CPM.cmake) | ||
configure_file(src/config.h.in config.h) | ||
set(CMAKE_CXX_STANDARD 20) | ||
|
@@ -32,10 +30,12 @@ set(CXX_STANDARD_REQUIRED ON) | |
option(ENABLE_Z3 "Enables the download and compilation of the expr::z3_driver driver. OFF by default" OFF) | ||
|
||
# DEPENDENCIES | ||
# library dependencies | ||
CPMAddPackage("gh:yalibs/[email protected]") | ||
CPMAddPackage("gh:yalibs/[email protected]") | ||
CPMAddPackage("gh:yalibs/[email protected]") | ||
# demo dependencies | ||
CPMAddPackage("gh:yalibs/[email protected]") | ||
CPMAddPackage("gh:yalibs/[email protected]") | ||
CPMAddPackage("gh:sillydan1/[email protected]") | ||
|
||
if(ENABLE_Z3) | ||
|
@@ -45,56 +45,53 @@ if(ENABLE_Z3) | |
endif() | ||
|
||
set(${PROJECT_NAME}_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE STRING "expr_BUILD_DIR" FORCE) | ||
find_package(FLEX REQUIRED) | ||
find_package(BISON REQUIRED) | ||
|
||
add_custom_command(OUTPUT | ||
${CMAKE_CURRENT_BINARY_DIR}/lex.l | ||
COMMAND m4 | ||
ARGS -I ${PROJECT_SOURCE_DIR}/src/parser/lex -P ${PROJECT_SOURCE_DIR}/src/parser/lex/scanner.l > ${CMAKE_CURRENT_BINARY_DIR}/lex.l | ||
VERBATIM) | ||
add_custom_command(OUTPUT | ||
${CMAKE_CURRENT_BINARY_DIR}/yacc.y | ||
COMMAND m4 | ||
ARGS -I ${PROJECT_SOURCE_DIR}/src/parser/yacc -P ${PROJECT_SOURCE_DIR}/src/parser/yacc/parser.y > ${CMAKE_CURRENT_BINARY_DIR}/yacc.y | ||
VERBATIM) | ||
|
||
BISON_TARGET(expr_parser ${CMAKE_CURRENT_BINARY_DIR}/yacc.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp) | ||
FLEX_TARGET(expr_lexer ${CMAKE_CURRENT_BINARY_DIR}/lex.l ${CMAKE_CURRENT_BINARY_DIR}/scanner.cpp) | ||
ADD_FLEX_BISON_DEPENDENCY(expr_lexer expr_parser) | ||
add_library(${PROJECT_NAME} SHARED | ||
${BISON_expr_parser_OUTPUTS} | ||
${FLEX_expr_lexer_OUTPUTS} | ||
src/drivers/interpreter.cpp | ||
src/drivers/tree_interpreter.cpp | ||
src/drivers/tree_compiler.cpp | ||
src/drivers/compiler.cpp | ||
|
||
src/clock.cpp | ||
src/symbol_table.cpp | ||
src/symbol/clock.cpp | ||
src/symbol/symbol_table.cpp | ||
src/operations/add.cpp | ||
src/operations/subtract.cpp | ||
src/operations/multiply.cpp | ||
src/operations/divide.cpp | ||
src/operations/modulo.cpp | ||
src/operations/pow.cpp | ||
src/operations/boolean.cpp) | ||
src/operations/boolean.cpp | ||
src/driver/evaluator.cpp | ||
) | ||
|
||
target_include_directories(${PROJECT_NAME} PUBLIC | ||
${CMAKE_CURRENT_BINARY_DIR} | ||
${CMAKE_CURRENT_BINARY_DIR}/src | ||
${yatree_SOURCE_DIR}/include | ||
${yatimer_SOURCE_DIR}/include | ||
${yaoverload_SOURCE_DIR}/include | ||
${yahashcombine_SOURCE_DIR}/include | ||
${argvparse_SOURCE_DIR}/include | ||
${z3_SOURCE_DIR}/src/api/c++ | ||
${z3_SOURCE_DIR}/include | ||
src/symbol | ||
include | ||
src) | ||
|
||
add_library(${PROJECT_NAME}_generic_driver SHARED src/generic-driver.cpp) | ||
target_include_directories(${PROJECT_NAME}_generic_driver PUBLIC | ||
${CMAKE_CURRENT_BINARY_DIR} | ||
${CMAKE_CURRENT_BINARY_DIR}/src | ||
${yatree_SOURCE_DIR}/include | ||
${yatimer_SOURCE_DIR}/include | ||
${yaoverload_SOURCE_DIR}/include | ||
${yahashcombine_SOURCE_DIR}/include | ||
${argvparse_SOURCE_DIR}/include | ||
${z3_SOURCE_DIR}/src/api/c++ | ||
${z3_SOURCE_DIR}/include | ||
src/symbol | ||
include | ||
src) | ||
|
||
add_subdirectory(src/expr-lang) | ||
|
||
if(ENABLE_Z3) | ||
target_sources(${PROJECT_NAME} PUBLIC src/drivers/z3_driver.cpp) | ||
target_sources(${PROJECT_NAME} PUBLIC src/driver/z3/z3-driver.cpp) | ||
target_link_directories(${PROJECT_NAME} PUBLIC ${z3_SOURCE_DIR}/bin) | ||
target_link_libraries(${PROJECT_NAME} z3) | ||
target_compile_definitions(${PROJECT_NAME} PUBLIC ENABLE_Z3) | ||
|
@@ -104,4 +101,6 @@ endif() | |
|
||
add_executable(${PROJECT_NAME}_demo src/main.cpp) | ||
set_target_properties(${PROJECT_NAME}_demo PROPERTIES RPATH ${z3_SOURCE_DIR}/bin) | ||
target_link_libraries(${PROJECT_NAME}_demo ${PROJECT_NAME} argvparse) | ||
target_link_libraries(${PROJECT_NAME}_demo ${PROJECT_NAME} expr_lang argvparse ${PROJECT_NAME}_generic_driver) | ||
target_link_libraries(${PROJECT_NAME}_generic_driver expr_lang) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.