| .. | ||
| bin | ||
| lib | ||
| test | ||
| .gitignore | ||
| .justfile | ||
| .ocamlformat | ||
| .ocamlformat-ignore | ||
| dune-project | ||
| dune-workspace | ||
| README.md | ||
| tori.opam | ||
iganaq OCaml
This is the OCaml implementation of the iganaq prototype. See the root README for the general description.
Configuration parser
Grammar v0.2:
assignment = { space }, key, { space }, equal, [ space ], value
key = letter, { letter | digit | "_" }, equal
value = valuable, { " " | valuable }, break
valuable = ( letter | digit | "_" | "-" | "~" | "/" ), { valuable }
equal = "="
break = "\n"
space = " " | "\t"
Written using the ISO 14977 EBNF Notation.
In this grammar, digit implies decimal digit. Spaces between the key and the = operator are lexed but meaningless. The first space after the = operator is parsed but meaningless. Additional spaces between the first space after the = operator and the first non-space character of the value are lexed and considered as part of the value. Spaces before the key and after the last non-space character until the newline are not lexed.
Note: non-terminals.keyandvalueare ambiguous- Resolved by specifying what character terminates each
Task list
-
Spec requirements
- Add log function
- Output begins with
[log] - Only prints if
DEBUGis set
- Output begins with
- Get su command from
$XDG_CONFIG_HOME/tori/tori.conf- Default to
su -c- Handle fatal
Sys_erroriftori.confdoesn't exist - Handle checking
su -cdefault withwhichwhentori.confexists butsu_commandis absent in it - Properly handle a compose
su_commandsuch assu -cinSystem.Package - Properly handle dependent options
- Implement log levels
- Write tests
- Handle fatal
- Validation
- Valid path or in
PATH - Executability
1trueexits with status 0
- Valid path or in
- Default to
- Add logging
- Logs only if DEBUG is set
- Print each command executed, not just package names
- Case with no packages provided
- Prints a message
- MUST NOT run any system commands
- Unrecognized command: exit code 1
- Command
user: print the output ofwhoami - Command
os: print the OS name- log the contents of
/etc/os-release2
- log the contents of
- Add log function
-
Incrementals
- Simplify and analyze
System.File - Simplify Reader
- Simplify and analyze
-
Additionals
-
Check out
References
- ISO 14977 EBNF Notation: https://www.iso.org/standard/26153.html
- Comparison of BNF notations: https://www.cs.man.ac.uk/~pjj/bnf/ebnf.html
- W3C ABNF Notation: https://www.w3.org/Notation.html
- W3C EBNF Notation from the XML 1.0 Spec: https://www.w3.org/TR/xml/#sec-notation
- IETF RFC 5234 ABNF Notation (replaces 4234, 2234): https://www.rfc-editor.org/rfc/rfc5234
- Don’t Use ISO/IEC 14977:1996 EBNF: https://dwheeler.com/essays/dont-use-iso-14977-ebnf.html
Notes
-
INS v0 A3.4 "running 'true' with exit code 0" requires the user to input their password every time. This was dropped in INS v0.2, where "run 'true' with exit code 0" was removed from A3.4 ↩︎
-
INS v0.1 changes requirement B2.3 to "MUST print the OS name and MUST log contents of /etc/os-release" in order to make the logging function testable without user input ↩︎
-
INS, Iganaq Napkin Spec: https://brew.bsd.cafe/tori/iganaq#specification ↩︎
-
INS v0 B2.5 "MUST NOT run any system commands" is only testable if we wrap command execution properly in e.g. a monad or list containing all executed commands, ensuring no command is ever executed without being appended to it ↩︎