Skip to content

Commit ac8532f

Browse files
authored
Merge pull request #44 from sillydan1/feat/detcheck
Version v1.1.0 - detcheck and cpp parsers
2 parents 2d0b28c + e4d2304 commit ac8532f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1092
-339
lines changed

.github/workflows/cmake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: checkout repository
2222
uses: actions/checkout@v2
2323
- name: install dependencies
24-
run: sudo apt-get install -y flex bison make m4 cmake
24+
run: sudo apt-get install -y flex bison make m4 cmake libfl-dev libbison-dev
2525
- name: create build environment
2626
run: cmake -E make_directory ${{ github.workspace }}/build
2727
- name: configure
Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
{
22
"version": "0.2.0",
33
"configurations": [
4+
{
5+
"name": "launch unit tests",
6+
"type": "codelldb",
7+
"request": "launch",
8+
"cwd": "${workspaceFolder}/Debug",
9+
"program": "${workspaceFolder}/Debug/aaltitoad_tests",
10+
"args": [
11+
]
12+
},
413
{
514
"name": "Launch Verifier",
615
"type": "codelldb",
716
"request": "launch",
817
"program": "${workspaceFolder}/Debug/verifier",
18+
"cwd": "${workspaceFolder}/Debug",
919
"args": [
1020
"-f", "../test/verification/fischer-suite/fischer-2/",
1121
"-q", "../test/verification/fischer-suite/fischer-2/Queries.json",
1222
"-i", ".*\\.ignore.*"
13-
],
14-
"cwd": "${workspaceFolder}/Debug"
23+
]
1524
}
1625
]
1726
}

CMakeLists.txt

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,28 @@
1414
# You should have received a copy of the GNU General Public License
1515
# along with this program. If not, see <https://www.gnu.org/licenses/>.
1616
cmake_minimum_required(VERSION 3.16) # 3.16+ because of target_precompiled_header
17-
project(aaltitoad VERSION 1.0.0)
17+
project(aaltitoad VERSION 1.1.0)
1818
set(THREADS_PREFER_PTHREAD_FLAG ON)
1919
set(CMAKE_CXX_STANDARD 20)
2020
set(CXX_STANDARD_REQUIRED ON)
2121
set(SPDLOG_BUILD_SHARED)
2222
set(CONFIG_IN_FILE src/config.h.in)
2323
set(CONFIG_OUT_FILE config.h)
2424
include(cmake/CPM.cmake)
25-
include(cmake/VER.cmake) # TODO: make a yalibs release of this cmake file
25+
include(cmake/VER.cmake) # TODO: yalibs candidate
2626
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
2727
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
2828
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
2929
set(CMAKE_MACOSX_RPATH 1)
3030
list(APPEND CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
3131

32+
find_package(BISON REQUIRED)
33+
find_package(FLEX REQUIRED)
34+
3235
add_compile_definitions(DEFAULT_EXPRESSION_VALUE="true")
33-
CPMAddPackage(NAME expr VERSION 2.2.0 GITHUB_REPOSITORY sillydan1/expr OPTIONS "ENABLE_Z3 ON")
36+
CPMAddPackage(NAME expr VERSION 3.0.0 GITHUB_REPOSITORY sillydan1/expr OPTIONS "ENABLE_Z3 ON")
3437
CPMAddPackage("gh:sillydan1/[email protected]")
35-
CPMAddPackage("gh:sillydan1/ctl-expr@1.1.2")
38+
CPMAddPackage("gh:sillydan1/ctl-expr@2.0.0")
3639

3740
CPMAddPackage("gh:yalibs/[email protected]")
3841
CPMAddPackage("gh:yalibs/[email protected]")
@@ -44,14 +47,17 @@ CPMAddPackage("gh:yalibs/[email protected]")
4447
CPMAddPackage("gh:yalibs/[email protected]")
4548
CPMAddPackage("gh:yalibs/[email protected]")
4649

47-
CPMAddPackage("gh:gabime/spdlog@1.8.2")
48-
CPMAddPackage("gh:nlohmann/json@3.10.5")
49-
CPMAddPackage("gh:neargye/[email protected].1")
50+
CPMAddPackage("gh:gabime/spdlog@1.11.0")
51+
CPMAddPackage("gh:nlohmann/json@3.11.2")
52+
CPMAddPackage("gh:neargye/[email protected].2")
5053

51-
CPMAddPackage("gh:cpm-cmake/[email protected].5")
54+
CPMAddPackage("gh:cpm-cmake/[email protected].6")
5255
cpm_licenses_create_disclaimer_target(write_licenses "${CMAKE_BINARY_DIR}/third_party.txt" "${CPM_PACKAGES}")
5356

54-
set(${PROJECT_NAME}_SOURCES
57+
add_library(${PROJECT_NAME} SHARED
58+
src/expr-wrappers/interpreter.cpp
59+
src/expr-wrappers/parameterized-expr-evaluator.cpp
60+
src/expr-wrappers/parameterized-ast-factory.cpp
5561
src/ntta/builder/ntta_builder.cpp
5662
src/ntta/tta.cpp
5763
src/ntta/interesting_tocker.cpp
@@ -61,14 +67,11 @@ set(${PROJECT_NAME}_SOURCES
6167
src/util/warnings.cpp
6268
src/util/random.cpp
6369
src/util/string_extensions.cpp)
64-
65-
# TODO: split the project up - each folder should have their own CMakeLists file
66-
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SOURCES})
6770
if(${CODE_COVERAGE})
6871
target_link_options(${PROJECT_NAME} PUBLIC --coverage)
6972
target_compile_options(${PROJECT_NAME} PUBLIC --coverage)
7073
endif()
71-
target_link_libraries(${PROJECT_NAME} expr dl pthread ctl)
74+
target_link_libraries(${PROJECT_NAME} PUBLIC expr_lang dl pthread ctl_lang)
7275
target_include_directories(${PROJECT_NAME} PUBLIC
7376
${CMAKE_BINARY_DIR}
7477
${CMAKE_CURRENT_BINARY_DIR}
@@ -96,15 +99,19 @@ target_include_directories(${PROJECT_NAME} PUBLIC
9699
${yapermutation_SOURCE_DIR}/include
97100
${yasetwrappers_SOURCE_DIR}/include
98101
src
102+
# strictly not required, but it helps my clangd lsp setup and it doesn't hurt
103+
${FLEX_INCLUDE_DIRS}
104+
${BISON_INCLUDE_DIRS}
99105
)
100106

101107
add_compile_definitions(ENABLE_Z3)
102108
add_subdirectory(src/cli/simulator)
103109
add_subdirectory(src/cli/verifier)
110+
add_subdirectory(src/cli/detcheck)
104111
add_subdirectory(src/parser)
105112
add_subdirectory(test)
106113

107-
install(TARGETS ${PROJECT_NAME} expr ctl)
114+
install(TARGETS ${PROJECT_NAME} expr_lang ctl_lang verifier simulator detcheck)
108115
install(FILES src/man/tta.7 DESTINATION man/man7)
109116
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
110117
install(FILES ${CMAKE_BINARY_DIR}/libz3.so DESTINATION lib)
@@ -115,10 +122,9 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
115122
else()
116123
message(WARNING "unknown system ${CMAKE_SYSTEM_NAME}")
117124
endif()
118-
119-
# TODO: determine required header files for plugins and add them to the install target
120-
# install(DIRECTORY src/ntta src/plugin_system src/util DESTINATION include FILES_MATCHING PATTERN "*.h")
125+
install(DIRECTORY src/ntta src/plugin_system src/util src/verification src/parser DESTINATION include FILES_MATCHING PATTERN "*.h")
121126

122127
if(NOT WIN32)
123128
target_precompile_headers(${PROJECT_NAME} PUBLIC src/aaltitoadpch.h)
124129
endif()
130+

cmake/CPM.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
set(CPM_DOWNLOAD_VERSION 0.36.0)
1+
set(CPM_DOWNLOAD_VERSION 0.38.0)
22

33
if(CPM_SOURCE_CACHE)
44
# Expand relative path. This is important if the provided path contains a tilde (~)

src/cli/cli_common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626

2727
int print_required_args() {
2828
std::cout << "Required arguments:\n";
29-
std::cout << " --input\n";
29+
std::cout << " --input / -f\n";
3030
return 1;
3131
}
3232

3333
int print_help(const std::string& program_name, const std::vector<option_t>& options) {
3434
std::cout << get_license() << std::endl;
3535
std::cout << PROJECT_NAME << " v" << PROJECT_VER << std::endl;
36-
std::cout << "USAGE: " << program_name << " -i /path/to/tta/dir [OPTIONS] \n" << std::endl;
36+
std::cout << "USAGE: " << program_name << " -f /path/to/tta/dir [OPTIONS] \n" << std::endl;
3737
std::cout << "OPTIONS: " << std::endl;
3838
print_argument_help(options);
3939
return 0;

src/cli/detcheck/CMakeLists.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# aaltitoad - a verification engine for tick tock automata models
2+
# Copyright (C) 2023 Asger Gitz-Johansen
3+
#
4+
# This program is free software: you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License as published by
6+
# the Free Software Foundation, either version 3 of the License, or
7+
# (at your option) any later version.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
#
17+
project(detcheck VERSION 1.0.0)
18+
find_package(argvparse REQUIRED)
19+
add_executable(${PROJECT_NAME} main.cpp)
20+
target_link_libraries(${PROJECT_NAME} aaltitoad argvparse)
21+
if(TARGET default_plugins)
22+
add_dependencies(${PROJECT_NAME} default_plugins)
23+
endif()
24+
install(TARGETS ${PROJECT_NAME})
25+

src/cli/detcheck/cli_options.h

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/**
2+
* aaltitoad - a verification engine for tick tock automata models
3+
Copyright (C) 2023 Asger Gitz-Johansen
4+
5+
This program is free software: you can redistribute it and/or modify
6+
it under the terms of the GNU General Public License as published by
7+
the Free Software Foundation, either version 3 of the License, or
8+
(at your option) any later version.
9+
10+
This program is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU General Public License for more details.
14+
15+
You should have received a copy of the GNU General Public License
16+
along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
#ifndef AALTITOAD_CLI_OPTIONS_H
19+
#define AALTITOAD_CLI_OPTIONS_H
20+
21+
std::vector<option_t> get_options() {
22+
return {
23+
{"input", 'f', argument_requirement::REQUIRE_ARG, "(Required) input folder containing diagram files to parse and simulate"},
24+
{"version", 'V', argument_requirement::NO_ARG, "Print version and exit"},
25+
{"verbosity", 'v', argument_requirement::REQUIRE_ARG, "Set verbosity level (6 for max verbosity)"},
26+
{"ignore", 'i', argument_requirement::REQUIRE_ARG, "Specify a file to ignore (-i file1 -i file2 for multiple files)"},
27+
{"parser", 'p', argument_requirement::REQUIRE_ARG, "Specify the parser to use"},
28+
{"plugin-dir", 'P', argument_requirement::REQUIRE_ARG, "Specify directories to look for parser plugins"},
29+
{"instance", 'n', argument_requirement::REQUIRE_ARG, "Specify tta instances to check"},
30+
{"instance-file", 'N', argument_requirement::REQUIRE_ARG, "Specify a json-encoded file containing tta instances to check"},
31+
{"list-instances",'L', argument_requirement::NO_ARG, "List available instances and exit"},
32+
33+
{"known", 'k', argument_requirement::REQUIRE_ARG, "Specify known symbol declarations"},
34+
{"known-file", 'K', argument_requirement::REQUIRE_ARG, "Specify a json-encoded file containing known symbol declarations"},
35+
{"condition", 'c', argument_requirement::REQUIRE_ARG, "Specify a condition. This will be added to all bool checks"},
36+
{"condition-file",'C', argument_requirement::REQUIRE_ARG, "Specify a json-encoded file containing extra conditions"},
37+
};
38+
}
39+
40+
bool is_required(const std::string& s) {
41+
if(s == "input")
42+
return true;
43+
return false;
44+
}
45+
46+
bool is_required_provided(std::map<std::string, argument_t>& provided_args, const std::vector<option_t>& options) {
47+
if(provided_args["version"])
48+
return true;
49+
for(auto& opt : options) {
50+
if(is_required(opt.long_option) && !provided_args[opt.long_option])
51+
return false;
52+
}
53+
return true;
54+
}
55+
#endif //AALTITOAD_CLI_OPTIONS_H

0 commit comments

Comments
 (0)