From 3e73f67b0eb3d658a74c7de985b39e6c06ca4e5f Mon Sep 17 00:00:00 2001 From: vhavlena Date: Fri, 12 Jan 2024 09:31:29 +0100 Subject: [PATCH 1/6] readme: fixing python example --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0fb3eca8e..c58ec6425 100644 --- a/README.md +++ b/README.md @@ -163,10 +163,10 @@ example: example.cc The python binding is installed (by default) to your local python package repository. You can either use the binding in your own scripts or in the python interpreter. -You can start using the binding by importing the `mata` package. +You can start using the binding by importing the `libmata` package. ```python -import mata +import libmata.nfa.nfa as mata_nfa ``` In your own scripts, we recommend to use the standard guard for running the scripts, as follows. @@ -178,12 +178,12 @@ if __name__ == "__main__": The usage of the binding copies (to certain levels) the usage of the C++ library. ```python - aut = mata.Nfa(4) + aut = mata_nfa.Nfa(4) - aut.initial = {0, 1} - aut.final = {2, 3} - aut.add_trans_raw(0, 0, 2) - aut.add_trans_raw(1, 1, 3) + aut.initial_states = {0, 1} + aut.final_states = {2, 3} + aut.add_transition(0, 0, 2) + aut.add_transition(1, 1, 3) print(aut.to_dot_str()) ``` From 82436dd9a59b940b8832a1edec6f6ba2da26b065 Mon Sep 17 00:00:00 2001 From: vhavlena Date: Fri, 12 Jan 2024 10:01:48 +0100 Subject: [PATCH 2/6] readme: pypi install --- README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c58ec6425..6e920fd4e 100644 --- a/README.md +++ b/README.md @@ -39,10 +39,21 @@ Run the following to install the dependencies for Ubuntu: sudo apt-get install -y build-essential lcov gcovr xdg-utils ``` -# Building the Python binding from sources +# Python binding Mata offers binding of its efficient library to Python. You can install the binding as an Python -package on your system as follows. First, install the necessary requirements for Python and your +package on your system as follows. + +### Install from PyPI + +To install a latest version from the PyPI repository, run +``` +pip3 install libmata +``` + +### Building from sources + +To build from sources first, install the necessary requirements for Python and your system. We recommend using the virtual environemnt (`venv`) to install and use the library. ``` From e7948d0c76277205b2806552e42f1948ddf2e8e8 Mon Sep 17 00:00:00 2001 From: vhavlena Date: Fri, 12 Jan 2024 13:13:32 +0100 Subject: [PATCH 3/6] readme: making c++ examples to run --- README.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6e920fd4e..9f8ce3c9b 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,13 @@ cd mata make release ``` -In order, to verify the functionality of the library, you can run the test suite: +In order to install the library, you can run + +``` +sudo make install +``` + +In order to verify the functionality of the library, you can run the test suite: ``` make test @@ -113,7 +119,7 @@ First import the library in your code. If the library is properly installed, you the standard include. ```cpp -#include +#include ``` We recommend to use the `mata::nfa` namespace for easier usage: @@ -139,8 +145,8 @@ You can set the initial and final states directly using the initializers. Further, you can add transitions in form of tripple `(state_from, symbol, targets)`: ```cpp - aut.add_trans(0, 0, 2); - aut.add_trans(1, 1, 3); + aut.delta.add(0, 0, 2); + aut.delta.add(1, 1, 3); ``` You can verify the state of your automaton by generating the automaton in `.dot` format. @@ -155,7 +161,7 @@ You can verify the state of your automaton by generating the automaton in `.dot` Finally, compile the code using the following Makefile: ```makefile -CFLAGS=-std=c++14 -pedantic-errors -Wextra -Wall -Wfloat-equal -Wctor-dtor-privacy -Weffc++ -Woverloaded-virtual -fdiagnostics-show-option -g +CFLAGS=-std=c++20 -pedantic-errors -Wextra -Wall -Wfloat-equal -Wctor-dtor-privacy -Weffc++ -Woverloaded-virtual -fdiagnostics-show-option -g INCLUDE=-I../include -I../3rdparty/simlib/include -I../3rdparty/re2/include LIBS_ADD=-L../build/src -L../build/3rdparty/re2 -L../build/3rdparty/simlib From d1d3e29c32debbbdb60540e39a011a636d41e9c1 Mon Sep 17 00:00:00 2001 From: vhavlena Date: Wed, 17 Jan 2024 14:44:38 +0100 Subject: [PATCH 4/6] readme: requirements and dependencies --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 9f8ce3c9b..68eca8abf 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,16 @@ Mata is an open source automata library that offers interface for different kind 1. An efficient library implemented in C/C++ 2. A flexible wrapper implemented in Python that uses the efficient library +# Requirements and Dependencies + +For a successful installation of Mata, `cmake` of version `3.15.0` (or higher) and a C++ compiler with a support of C++-20 standard is required. +From optional requirements, `doxygen` is required for a generation of the documentation and `catch2` is required for the unit testing (Mata can still be compiled without these optional dependencies). + +The Mata library further depends on the following libraries, included in the `3rdparty` directory: +- `cudd` for BDD manipulation, +- `re2` for regular expression parsing and the corresponding automata construction, and +- `simlib` for a simulation computation. + # Building from sources To build the library, run the following: From 525286342bfebc7bafaf7749e042be8f9f8d6416 Mon Sep 17 00:00:00 2001 From: vhavlena Date: Wed, 17 Jan 2024 14:49:24 +0100 Subject: [PATCH 5/6] readme: minor --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 68eca8abf..41cf5c0ec 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Mata is an open source automata library that offers interface for different kind 1. An efficient library implemented in C/C++ 2. A flexible wrapper implemented in Python that uses the efficient library -# Requirements and Dependencies +# Requirements and dependencies For a successful installation of Mata, `cmake` of version `3.15.0` (or higher) and a C++ compiler with a support of C++-20 standard is required. From optional requirements, `doxygen` is required for a generation of the documentation and `catch2` is required for the unit testing (Mata can still be compiled without these optional dependencies). @@ -20,7 +20,7 @@ The Mata library further depends on the following libraries, included in the `3r - `re2` for regular expression parsing and the corresponding automata construction, and - `simlib` for a simulation computation. -# Building from sources +# Building and installing from sources To build the library, run the following: From 864a697a2b775dd1b1f6c33cba9f1ab22845382a Mon Sep 17 00:00:00 2001 From: vhavlena Date: Fri, 19 Jan 2024 09:22:58 +0100 Subject: [PATCH 6/6] readme: add cmake instead of Makefile --- README.md | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 41cf5c0ec..4ea7aab75 100644 --- a/README.md +++ b/README.md @@ -168,24 +168,22 @@ You can verify the state of your automaton by generating the automaton in `.dot` } ``` -Finally, compile the code using the following Makefile: +We recommend `cmake` for building projects using Mata. Provided the Mata is installed in the system directories, +the `CMakeLists.txt` file for the example may look like: -```makefile -CFLAGS=-std=c++20 -pedantic-errors -Wextra -Wall -Wfloat-equal -Wctor-dtor-privacy -Weffc++ -Woverloaded-virtual -fdiagnostics-show-option -g +```cmake +cmake_minimum_required (VERSION 3.15.0) +project (mata-example) +set (CMAKE_CXX_STANDARD 20) -INCLUDE=-I../include -I../3rdparty/simlib/include -I../3rdparty/re2/include -LIBS_ADD=-L../build/src -L../build/3rdparty/re2 -L../build/3rdparty/simlib -LIBS=-lmata -lsimlib -lre2 +find_library(LIBMATA mata REQUIRED) -.PHONY: all clean - -all: $(patsubst %.cc,%,$(wildcard *.cc)) ../build/src/libmata.a - -example: example.cc - g++ $(CFLAGS) $(INCLUDE) $(LIBS_ADD) $< $(LIBS) -o $@ +add_executable(mata-example + mata-example.cc) +target_link_libraries(mata-example PUBLIC ${LIBMATA}) ``` -## Using the binding +## Using the Python binding The python binding is installed (by default) to your local python package repository. You can either use the binding in your own scripts or in the python interpreter.