Skip to content

dawedawe/theotui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

129 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

theotui

Please note: This is only a mirror repository. Development takes place on codeberg.


A TUI for various topics from theoretical computer science, implemented in Rust with Ratatui.
It aims to help learning these topics by offering simple ways of exploration and experimentation.
Currently the following topics are implemented:

  • set theory
  • propositional logic
  • deterministic finite automata
  • type-3 grammars

More will follow.
The core logic, without the TUI part, can be used through the crate theoinf.

set theory

All the usual operations of naive set theory are implemented.
Press F1 to toggle the help next to the editor.
Press F5 to let your terms be evaluated.

set theory

propositional logic

All the usual operations of propositional logic are implemented.
Press F1 to toggle the help next to the editor.
Press F5 or Enter to let your formula be evaluated.
The truth table can be filtered with Ctrl-t/Ctrl-f to only show the assignments resulting in true or false.
The CNF and DNF are constructed if possible.

propositional logic

deterministic finite automata (DFA)

A DFA is defined with the usual 5 parts:

  • Sigma, the alphabet
  • S, the set of states
  • start, the starting state
  • F, the set of accepting states
  • delta, the set of state transitions

A single transition is a tuple of 3: (current_state, symbol, next_state)
Press F1 to toggle the help next to the editor.
Press F5 or Enter in the Word input to let your word be checked for acceptance.
With the argument --dfa file.txt a stored definition can be read from the given file at the start of theotui.
Here's a complete definition example:

Sigma = { 'a', 'b' }
S = { s0, s1, s2 }
start = s0
F = { s2 }
delta = { (s0, 'a', s1), (s1, 'b', s2) }

dfa

type-3 grammars

A Type-3 Grammar is defined with the usual 4 parts:

  • V, the set of non-terminals
  • Sigma, the set of terminals
  • P, the set of production rules
  • S, the start non-terminal

A single right-regular production rule has one of the following three forms:

  • T -> 'aT'
  • T -> 'a'
  • T -> '' here the empty word epsilon is denoted as ''

A single left-regular production rule has one of the following three forms:

  • T -> 'Ta'
  • T -> 'a'
  • T -> '' here the empty word epsilon is denoted as ''

Press F1 to toggle the help next to the editor.
Press F5 or Enter in the Word input to let your word be checked for a possible production.
With the argument --t3g file.txt a stored definition can be read from the given file at the start of theotui.
Here's a complete definition example:

V = { S, T }
Sigma = { 'a', 'b' }
P = { S -> 'aT', T -> 'b', T -> 'bT', T -> '' }
S = S

type-3 grammar

Usage

Usage: theotui [OPTIONS]
Options:
  --dfa file        Read DFA definition from file
  --t3g file        Read Type-3 Grammar definition from file
  --help            Print help

Installation

cargo install theotui

About

A TUI and crates for various topics from theoretical computer science.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages