├── .gitignore
├── CMakeLists.txt
├── LICENSE
├── README-RU.md
├── README.md
├── forReadme
├── 1.gif
├── 2.gif
├── EN-help.png
├── EN-icon.png
├── RU-help.png
└── RU-icon.png
├── include
├── debug.hpp
├── translate.hpp
├── turing.hpp
└── turingUI.hpp
├── run.sh
└── src
├── main.cpp
├── translate.cpp
├── turing.cpp
└── turingUI.cpp
/.gitignore:
--------------------------------------------------------------------------------
1 | # Prerequisites
2 | *.d
3 |
4 | # Compiled Object files
5 | *.slo
6 | *.lo
7 | *.o
8 | *.obj
9 |
10 | # Precompiled Headers
11 | *.gch
12 | *.pch
13 |
14 | # Compiled Dynamic libraries
15 | *.so
16 | *.dylib
17 | *.dll
18 |
19 | # Fortran module files
20 | *.mod
21 | *.smod
22 |
23 | # Compiled Static libraries
24 | *.lai
25 | *.la
26 | *.a
27 | *.lib
28 |
29 | # Executables
30 | *.exe
31 | *.out
32 | *.app
33 | *.json
34 |
35 | MAIN
36 | turing-cmd
37 | DEBUG_log.txt
38 |
39 | **/build
40 | **/.vscode
41 | **/.cache
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.24)
2 |
3 | project(Turing
4 | LANGUAGES CXX
5 | VERSION 0.2
6 | )
7 |
8 | set(CMAKE_BUILD_TYPE Release)
9 |
10 | include(FetchContent)
11 |
12 | set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
13 |
14 | FetchContent_Declare(ftxui
15 | GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
16 | GIT_TAG v4.0.0
17 | FIND_PACKAGE_ARGS NAMES ftxui
18 | )
19 |
20 | FetchContent_Declare(json
21 | GIT_REPOSITORY https://github.com/nlohmann/json
22 | GIT_TAG v3.10.5
23 | FIND_PACKAGE_ARGS NAMES nlohmann_json
24 | )
25 |
26 | FetchContent_MakeAvailable(ftxui json)
27 |
28 | set(CMAKE_CXX_STANDARD 20)
29 |
30 | include_directories(include)
31 |
32 | add_library(TuringLib src/turing.cpp)
33 | add_library(TuringUI src/turingUI.cpp)
34 | add_library(Translate src/translate.cpp)
35 |
36 | target_link_libraries(Translate TuringLib)
37 |
38 | target_link_libraries(TuringUI PRIVATE Translate ftxui::screen ftxui::dom ftxui::component TuringLib nlohmann_json::nlohmann_json)
39 |
40 | add_executable(turing-cmd src/main.cpp)
41 | target_link_libraries(turing-cmd PRIVATE Translate ftxui::screen ftxui::dom ftxui::component TuringLib TuringUI nlohmann_json::nlohmann_json)
42 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 DanArmor
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README-RU.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # turing_cmd
4 |
5 | [](README.md)
6 |
7 | Машина Тьюринга с интерфейсом в командной строке.
8 |
9 | 
10 |
11 | ## Table of contents
12 | - [turing_cmd](#turing-cmd)
13 | * [Возможности](#features)
14 | + [Пример загрузки и сохранения программы](#example-of-save-load)
15 | + [Полный текст справки](#full-reference-text)
16 | * [Известные проблемы](#known-issues)
17 | * [Установка](#installation)
18 | + [Ubuntu/Debian](#ubuntu-debian)
19 | * [Сборка](#build)
20 | * [Спасибо создателям библиотек](#thanks-for-libraries-creators)
21 | * [История изменений](#changelog)
22 |
23 |
24 |
25 | ## Возможности:
26 | - Бесконечная лента
27 | - Пошаговое выполнение
28 | - Непрерывное выполнение
29 | - Сохранение Машины в файл и загрузка из файла.
30 |
31 |
32 |
33 | ### Пример загрузки и сохранения программы:
34 | 
35 |
36 | Возможна навигация стрелками и мышкой, выход на Esc. Присутствуют горячие клавиши.
37 |
38 |
39 |
40 | ### Полный текст справки:
41 | 
42 |
43 |
44 |
45 | ## Известные проблемы:
46 | - Сохранения с кириллицей и/или широкими символами (греческие и т.п.) работают не всегда корректно (По этой причине в сохранеии лямбда заменена знаком #). Применяйте, пожалуйста, на данный момент числа и латиницу
47 |
48 |
49 |
50 | ## Установка
51 |
52 | Вы можете использовать скомпилированную версию из [релизов](https://github.com/DanArmor/turing_cmd/releases) (пока только для Linux).
53 |
54 |
55 |
56 | ### Ubuntu/Debian:
57 | [Имеется PPA репозиторий.](https://launchpad.net/~danarmor/+archive/ubuntu/ppa).
58 | * `sudo add-apt-repository ppa:danarmor/ppa`
59 | * `sudo apt update`
60 | * `sudo apt install turing-cmd`
61 | Готово - вы можете запустить программу командой `turing-cmd` в терминале.
62 |
63 |
64 |
65 | ## Сборка:
66 | Программа имеет две зависимости, указанные в конце Readme, но если у вас имеется CMake - достаточно создать каталог build и запусть run.sh, или запустить CMake/make вручную - файл CMakeLists уже настроен так, чтобы скачать необходимые зависимости.
67 |
68 |
69 |
70 | ## Спасибо создателям библиотек:
71 | - [nlohmann/json](https://github.com/nlohmann/json) - работа с JSON (текущая библиотека)
72 | - [ArthurSonzogni/FTXUI](https://github.com/ArthurSonzogni/FTXUI) - TUI
73 | - [taocpp/json](https://github.com/taocpp/json) - работа с JSON (была использована в первой версии)
74 |
75 |
76 |
77 | ## История изменений:
78 |
79 | V0.2.1 - FTXUI 4.0.0
80 |
81 | v0.2 - переход на новую библиотеку json, переход с wchar/wstring, изменение save/load уведомления, переход на FTXUI V3.0.0
82 |
83 | v0.1 - первая версия
84 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # turing_cmd
4 |
5 | [](README-RU.md)
6 |
7 | Turing machine with TUI
8 |
9 | 
10 |
11 | ## Table of contents
12 | - [turing_cmd](#turing-cmd)
13 | * [Features](#features)
14 | + [Example of save/load](#example-of-save-load)
15 | + [Full reference text](#full-reference-text)
16 | * [Known issues](#known-issues)
17 | * [Installation](#installation)
18 | + [Ubuntu/Debian:](#ubuntu-debian)
19 | * [Build](#build)
20 | * [Thanks for libraries creators](#thanks-for-libraries-creators)
21 | * [Changelog](#changelog)
22 |
23 |
24 |
25 |
26 | ## Features:
27 | - Endless tape
28 | - Step by step execution
29 | - Continuous exectuion
30 | - Save/load from file.
31 |
32 |
33 |
34 | ### Example of save/load:
35 | 
36 |
37 | You can navigate with keyboard arrows or with mouse, exit by Esc. There are hotkeys.
38 |
39 |
40 |
41 | ### Full reference text:
42 | 
43 |
44 |
45 |
46 | ## Known issues:
47 | - Cyrillic and/or widechars (like greek symbols) are working not properly. Use english.\
48 |
49 |
50 |
51 | ## Installation:
52 |
53 | You can use binaries from [releases](https://github.com/DanArmor/turing_cmd/releases) (Linux only for now).
54 |
55 |
56 |
57 | ### Ubuntu/Debian:
58 | [The PPA repo is provided](https://launchpad.net/~danarmor/+archive/ubuntu/ppa).
59 | * `sudo add-apt-repository ppa:danarmor/ppa`
60 | * `sudo apt update`
61 | * `sudo apt install turing-cmd`
62 | Done - you can start program by `turing-cmd` command in terminal.
63 |
64 |
65 |
66 | ## Build:
67 | There are two deps, but if you have CMake - you're ready to go: make a "build" dir and execute "run.sh".
68 |
69 |
70 |
71 | ## Thanks for libraries creators:
72 | - [nlohmann/json](https://github.com/nlohmann/json) - JSON (are used now)
73 | - [ArthurSonzogni/FTXUI](https://github.com/ArthurSonzogni/FTXUI) - TUI
74 | - [taocpp/json](https://github.com/taocpp/json) - JSON (was used in first version)
75 |
76 |
77 |
78 | ## Changelog:
79 |
80 | v0.2.1 - FTXUI V4.0.0
81 |
82 | v0.2 - moved to nlohmann/json, replaced wchar/wstring with char/string, changed save/load notification, moved to FTXUI V3.0.0
83 |
84 | v0.1 - init version
85 |
--------------------------------------------------------------------------------
/forReadme/1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DanArmor/turing_cmd/1107d665bb9ef22d6e98512e3ecf56a8c643c1bd/forReadme/1.gif
--------------------------------------------------------------------------------
/forReadme/2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DanArmor/turing_cmd/1107d665bb9ef22d6e98512e3ecf56a8c643c1bd/forReadme/2.gif
--------------------------------------------------------------------------------
/forReadme/EN-help.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DanArmor/turing_cmd/1107d665bb9ef22d6e98512e3ecf56a8c643c1bd/forReadme/EN-help.png
--------------------------------------------------------------------------------
/forReadme/EN-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DanArmor/turing_cmd/1107d665bb9ef22d6e98512e3ecf56a8c643c1bd/forReadme/EN-icon.png
--------------------------------------------------------------------------------
/forReadme/RU-help.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DanArmor/turing_cmd/1107d665bb9ef22d6e98512e3ecf56a8c643c1bd/forReadme/RU-help.png
--------------------------------------------------------------------------------
/forReadme/RU-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DanArmor/turing_cmd/1107d665bb9ef22d6e98512e3ecf56a8c643c1bd/forReadme/RU-icon.png
--------------------------------------------------------------------------------
/include/debug.hpp:
--------------------------------------------------------------------------------
1 | #define DEBUG
2 | #ifdef DEBUG
3 | #ifndef _INC_DEBUG_HPP
4 | #define _INC_DEBUG_HPP
5 | #include
6 |
7 | extern std::ofstream DEBUG_output;
8 |
9 | #define DEBUG_write(str) {DEBUG_output << str << "\n";}
10 |
11 |
12 | #endif
13 | #endif
--------------------------------------------------------------------------------
/include/translate.hpp:
--------------------------------------------------------------------------------
1 | #ifndef _INC_TRANSLATE_HPP
2 | #define _INC_TRANSLATE_HPP
3 |
4 | #include "debug.hpp"
5 |
6 | #include