Update manuals and other additions

This commit is contained in:
2026-06-09 12:45:33 -05:00
parent 051b12f28d
commit 78fb8d6d7c
101 changed files with 1629 additions and 401 deletions
+148
View File
@@ -0,0 +1,148 @@
.\" PROTEL 2026 manual — Vincente D'Ingianni
.TH Pb 1 "June 2026" "PROTEL 2026" "User Commands"
.SH NAME
Pb \- PROTEL source beautifier (keyword uppercasing)
.SH SYNOPSIS
.B Pb
[\fIoptions\fR]
[[\fB\-\fR]
.I input
]
[[\fB\-\fR]
.I output
]
.SH DESCRIPTION
.B Pb
is the PROTEL 2026 beautifier. It performs lexical analysis on PROTEL
source and uppercases reserved keywords to match the style of the
PROTEL Reference Manual and historical Nortel/BNR listings.
.PP
.B Pb
is a filter\-style tool: it reads from standard input and writes to
standard output by default, and supports shell redirection, pipes, and
explicit input/output file arguments.
.PP
Non\-keyword identifiers, numeric literals, operators, and whitespace
are preserved exactly. Keywords inside
.B %
comments or inside
.B \(aq...\(aq
string literals are not altered.
.PP
Lines beginning with
.B $LI
(linker directives) are uppercased in full.
.PP
A first\-line UNIX shebang
.RI ( #!... )
is copied unchanged to the output so runnable
.B .P
programs keep their
.B Pc!
interpreter line (see
.BR Pc (1)).
.PP
If very few recognized keywords are found,
.B Pb
emits a warning on standard error but still produces output.
.SH OPTIONS
.TP
.BR \-b ", " \-\-bold
Wrap uppercased keywords in ANSI bold escape sequences
.RI ( \(rs033[1m " ... " \(rs033[0m )
for terminals that support bold text.
.TP
.B \-\-version
Print the
.B Pb
version
.RI ( Pb " 1.0 (PROTEL Beautifier)" )
and exit.
.TP
.BR \-h ", " \-\-help
Print usage and exit.
.SH ARGUMENTS
.TP
.I input
Source file to beautify. Defaults to standard input
.RB ( \- ).
Use
.B \-
explicitly to read from standard input when an output file is given.
.TP
.I output
Destination file. Defaults to standard output
.RB ( \- ).
Use
.B \-
explicitly to write to standard output when an input file is given.
.SH BEHAVIOR
.B Pb
tokenizes the source and matches tokens against the official PROTEL
reserved\-word list (Reference Manual Appendix A, derived from historical
.B oflpr
/
.B oflpi
sources). Matching tokens are forced to UPPERCASE.
.PP
Comment lines start with
.BR % .
String literals use single quotes; an embedded quote is written as two
single quotes
.RI ( \(aq\(aq ).
.PP
In GNU Emacs,
.B Pb
may be invoked on the current buffer via
.B C\-c C\-f
.RI ( M-x protel\-beautify ;
see Introductory Manual \(S7.2).
.SH EXIT STATUS
.TP
.B 0
Success.
.TP
.B 1
Input or output file error.
.SH EXAMPLES
Beautify a file in place (via a second file):
.PP
.RS
.B Pb examples/Hello.P build/Hello.pretty.P
.RE
.PP
Filter from standard input:
.PP
.RS
.B Pb \-\-bold < myprog.P > myprog.pretty.P
.RE
.PP
Pipe through a pager:
.PP
.RS
.B Pb < myprog.P | less
.RE
.PP
Copy input path to output path:
.PP
.RS
.B Pb myprog.P myprog.pretty.P
.RE
.PP
Bold keywords on standard output:
.PP
.RS
.B cat myprog.P | Pb \-\-bold
.RE
.SH "SEE ALSO"
.BR Pc (1),
.BR protel-mode
(Emacs),
Introductory Manual \(S7.0.1,
\(S7.2.
.SH AUTHORS
Vincente D'Ingianni \(em PROTEL 2026 revival project (original
.B Pb
from the 1990s, recreated 2026).
.SH COPYRIGHT
PROTEL \(co Vincente D'Ingianni / Binary Systems.
+324
View File
@@ -0,0 +1,324 @@
.\" PROTEL 2026 manual — Vincente D'Ingianni
.TH Pc 1 "June 2026" "PROTEL 2026" "User Commands"
.SH NAME
Pc \- PROTEL 2026 compiler (parser, transpiler, and GCC/clang++ driver)
.SH SYNOPSIS
.B Pc
[\fIoptions\fR]
.I input
[\fIinput\fR ...]
[\fB\-\-\fR \fIprogram\-args\fR ...]
.PP
.B Pc!
.I script.P
[\fIprogram\-args\fR ...]
.SH DESCRIPTION
.B Pc
is the PROTEL 2026 compiler driver. It parses PROTEL source, performs
strong type checking, transpiles to C++ (or C with
.BR \-\-emit\-c ),
and optionally invokes
.BR g++ ,
.BR clang++ ,
or
.BR c++
to produce object files or executables.
.PP
On first use,
.B Pc
bootstraps a private Python virtual environment
.RI ( .venv )
in the PROTEL project tree and installs parser dependencies (Lark).
.PP
The default source suffix is
.BR .P
(historical Nortel/BNR convention). The compiler does
.I not
require any particular extension; recognized suffixes are
.BR .P ,
.BR .protel ,
.BR .pt ,
.BR .ptl ,
and PLS edition suffixes
.B .AA01
through
.BR .ZZ99 .
Unrecognized names still compile when the file contains valid PROTEL source.
.PP
PLS edition files (for example
.IR vdi.aa01 )
automatically enable classical preprocessing (keyword normalization;
.B $LI
and
.B $EJECT
linker directives stripped before parse) even without
.BR \-\-classical .
.SH OPTIONS
.TP
.BR \-o ", " \-\-output " " \fIfile\fR
Write generated C/C++ source, an object file, or an executable to
.IR file .
When
.I file
ends in
.B .c
or
.BR .cpp ,
only source is emitted. Otherwise, an
.BR \-\-output
name that does not end in
.B .c
or
.B .cpp
implies compile/link mode.
.TP
.B \-\-classical
Use legacy PROTEL identifier rules (keywords remain UPPERCASE).
Automatically enabled for PLS edition suffixes.
.TP
.B \-\-parse\-only
Parse the source and print an abstract-syntax summary to standard error;
do not transpile or compile.
.TP
.B \-\-emit\-c
Emit C instead of C++ (default output is C++). Compile and link modes
require C++ output; do not combine
.B \-\-emit\-c
with
.BR \-\-compile ,
.BR \-\-run ,
or
.BR \-c .
.TP
.B \-\-compile
Transpile and compile to a native executable or object file.
.TP
.B \-\-run
Compile and run the program (implies
.BR \-\-compile ).
The process exit status is the integer returned by the ENTRY procedure,
or the shell status of the generated executable.
.TP
.BR \-c
Compile only: produce an object file (passed through to the C++ compiler).
.TP
.BR \-g
Generate debug information (passed through to the C++ compiler).
.TP
.B \-\-keep
Retain the generated
.B .cpp
(or
.BR .c )
file after compiling. By default, intermediate source in
.I build/
is removed once linking succeeds.
.TP
.B \-\-version
Print the
.B Pc
version
.RI ( Pc " 0.3.0" )
and exit.
.TP
.BR \-h ", " \-\-help
Print usage and exit.
.SH PROGRAM ARGUMENTS
When
.B \-\-run
is used, arguments intended for the PROTEL ENTRY procedure may follow a
.B \-\-
separator:
.PP
.RS
.B Pc
.I source.P
.B \-\-run \-\-
.I arg1 arg2 ...
.RE
.PP
These are forwarded to
.IR argc / argv
in the ENTRY procedure (Introductory Manual \(S5.5.2).
.SH MODES
.TP
.B Transpile only (default)
With no compile flags and no executable
.BR \-o ,
generated C++ is written to standard output.
.TP
.B Transpile to file
.B Pc
.I source.P \-o
.I out.cpp
writes generated source only.
.TP
.B Compile / link
.BR \-\-compile ,
.BR \-\-run ,
.BR \-c ,
or
.B \-o
naming a non\-source output triggers compilation. Generated C++ is written
under
.I build/
unless
.B \-o
names a
.B .cpp
path. The minimal I/O runtime
.RI ( src/runtime/protel_io.c )
is linked when needed. Default executable name is
.BR a.out .
.TP
.B Multiple inputs
More than one
.I input
file may appear on the command line; only the first is compiled. A warning
is issued for additional files.
.SH "SHEBANG RUNNER (Pc!)"
.B Pc!
(pronounced
.I "P c Bang" )
is a companion helper installed alongside
.BR Pc .
The exclamation mark echoes the
.B \(lq#!\(rq
.I shebang
convention and provides a short command\-line alias for running programs.
.PP
.B Pc!
is equivalent to:
.PP
.RS
.B Pc
.I script.P \-\-run \-\-
[\fIprogram\-args\fR ...]
.RE
.PP
Typical shebang line in an executable
.B .P
file:
.PP
.RS
.B #!/usr/bin/env Pc!
.RE
.PP
Requirements for direct execution:
.IP \(bu 3
Line 1 must be a UNIX shebang naming
.BR Pc! .
.IP \(bu 3
The file must be executable
.RI ( chmod +x ).
.IP \(bu 3
The PROTEL project directory must be on
.BR PATH
so
.B Pc!
and
.B Pc
are found.
.PP
Examples:
.PP
.RS
.nf
export PATH="$PWD:$PATH"
./examples/Hello.P
Pc! examples/Hello.P
Pc! examples/intro_5_5_2_args_exit.P one two
.fi
.RE
.PP
The preprocessor strips the shebang before parse; it is not PROTEL syntax.
.SH ENVIRONMENT
.TP
.B PATH
Must include the PROTEL project directory (or install prefix) so
.B Pc
and
.B Pc!
can be located by the shell and by
.BR "env" .
Quoted
.B \(lq~/PROTEL\(rq
in
.B PATH
does not expand; use
.BR $PWD ,
.BR $HOME/PROTEL ,
or an absolute path.
.SH FILES
.TP
.I .venv/
Project Python virtual environment (created on first run).
.TP
.I build/
Default directory for generated
.B .cpp
files during compilation.
.TP
.I src/runtime/protel_io.c
Minimal EXTERNAL I/O runtime linked by default.
.SH EXIT STATUS
.TP
.B 0
Success.
.TP
.B 1
Parse, type, transpile, compile, or I/O error.
.TP
.B >0
When
.B \-\-run
is used, the ENTRY procedure return value or program exit status.
.SH EXAMPLES
Transpile to standard output:
.PP
.RS
.B Pc examples/Hello.P
.RE
.PP
Compile and run:
.PP
.RS
.B Pc examples/Hello.P \-\-run
.RE
.PP
Named executable and ENTRY arguments:
.PP
.RS
.B Pc examples/intro_5_5_2_args_exit.P \-o build/ArgsExit \-\-run \-\- one two
.RE
.PP
Object file (PLS module):
.PP
.RS
.B Pc vdi.aa01 \-c \-o build/vdi.aa01.o
.RE
.PP
Keep generated C++ for inspection:
.PP
.RS
.B Pc myprog.P \-\-compile \-\-keep \-o build/myprog
.RE
.PP
Classical (legacy) identifiers:
.PP
.RS
.B Pc legacy.P \-\-classical \-\-run
.RE
.SH "SEE ALSO"
.BR Pb (1),
.BR protel-mode
(Emacs),
Introductory Manual \(S7.0,
\(S7.1,
\(S7.0.5,
Reference Manual \(S11.3 (type errors),
.IR docs/reference-error-messages.md
.SH AUTHORS
Vincente D'Ingianni \(em PROTEL 2026 revival project.
.SH COPYRIGHT
PROTEL \(co Vincente D'Ingianni / Binary Systems.