bool

Програм за тестирање логичких израза
git clone https://git.sr.ht/~strahinja/bool
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување 695201985af443522b9b741c3a5be3d59e49e361
родитељ 75591428cda8073724586d0a5f2bb85c72e2d44a
Аутор: Страхиња Радић <sr@strahinja.org>
Датум:   Tue, 20 Jan 2026 15:35:13 +0100

Add bool.1.in

Diffstat:
Abool.1.in | 103+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
измењених датотека: 1, додавања: 103(+), брисања: 0(-)

diff --git a/bool.1.in b/bool.1.in @@ -0,0 +1,103 @@ +.\" This program is licensed under the terms of GNU GPL v3 or (at your option) +.\" any later version. Copyright (C) 2026 Страхиња Радић. +.\" See the file LICENSE for exact copyright and license details. +.Dd %DATE% +.Dt BOOL 1 +.Os +.Sh NAME +.Nm bool +.Nd Logical expression tester +.Sh SYNOPSIS +.Nm +.Fl hVv +.Nm +.Op Fl dt +.Ar filename +.Sh DESCRIPTION +.Nm +is a logical expression tester. +It takes a logical expression as input, containing logical variable names, +brackets and logical operators, and for each combination of values of different +variables outputs the values of variables and the evaluated value of the +expression, separated by TAB characters (like a TSV table). +.Bl -tag -width Ds +.It Fl d +Debug mode: output extended debug information in addition to the simulation +output. +.It Fl h +Show option summary. +.It Fl t +Output syntax tree instead of the simulation output. +AST is output in the format which can be piped to +.Xr dtree 1 . +.It Fl V +Show full version information: like +.Fl v , +followed by copyright notice. +.It Fl v +Show version information: program version and source git repository commit date. +.El +. +.Ss Expression description language +An expression +.Ar expr +can be one of the following: +.Bl -tag -width "A AND B" -offset indent +.It Ar ident +Variable identifier. +Identifiers consist of one or more uppercase and lowercase latin letters and +digits. +An identifier cannot start with a digit. +.It Ar expr Ms \[u007C] Ar expr +Logical OR (disjunction). +.It Ar expr Ms & Ar expr +Logical AND (conjunction). +.It Ar expr Ms ^ Ar expr +Logical XOR (exclusive or). +.It Ar expr Ms => Ar expr +Logical implication. +.It Ms ~ Ar expr +Logical NOT (negation). +.It Ms \[u0028]\& Ar expr Ms \[u0029] +Parentheses (force operator precedence). +.El +. +.Sh EXIT STATUS +.Ex -std +.Pp +For errors caused by the unsuccessful calls to libc functions setting +.Va errno , +that value is returned as the exit status. +. +.Sh EXAMPLES +.Bd -literal +$ printf "~A1 | A2 & A3\(rsn" | bool | tsvtable -n -saa ++------------------+------------------+------------------+------------------+ +|A1 |A2 |A3 |Result | +|F |F |F |T | +|F |F |T |T | +|F |T |F |T | +|F |T |T |T | +|T |F |F |F | +|T |F |T |F | +|T |T |F |F | +|T |T |T |T | ++------------------+------------------+------------------+------------------+ +.Ed +.Bd -literal +$ printf "~A1 | A2 & A3\(rsn" | bool -t | dtree -sa +OR ++--NOT +| `--[ID(0) = "A1"] +`--AND + +--[ID(1) = "A2"] + `--[ID(2) = "A3"] +.Ed +. +.Sh AUTHORS +.An Strahinya Radich Aq Mt sr@strahinja.org , +2026 +. +.Sh BUGS +Bugs can be reported using the ticket tracker at: +.Lk https://\:todo.sr.ht/\:~strahinja/\:bool