log-e-sappho/README.md
2025-06-28 01:40:36 +02:00

84 lines
2.1 KiB
Markdown

# log-e-sappho
experimental type system implementation
## getting and building
This will get you a basic build configured for development and debugging in the
subdirectory `build-debug/` of repository base:
```sh
git clone https://gitta.log-e.se/lnsol/log-e-sappho.git
cd ./log-e-sappho
cmake . --preset=debug
cd build-debug
make
```
To get sane error messages from editors using `clangd` for diagnostics, i.e.
using the same compilation flags configured for the build by cmake, in the repo
base directory link `compile_commands.json`:
```sh
ln -s build-debug/compile_commands.json
```
## "Code style"
I learned C from a guy that used to hack on OpenBSD, and just got used to
writing it this way. If you wanna hack on this yourself, use your judgement.
Look at the rest of the code and make yours look similar. Like, who cares about
rules really? Here are some guidelines tho.
**80 columns text width.**
Use **8 spaces wide TABS** (yes, actual TABS, not just 8 spaces) for
indentation and when inside `while`-/`if`-/etc. **conditions that span multiple
lines, indent 4 spaces + 0 or more TABS**, as to separate condition from body
of the conditional statement.
(Look at the following examples using a tab width of 8, otherwise they won't
make much sense.)
I.e. do
```c
if (1 /* this is a very long condition */
== 2 /* spanning multiple lines */
|| 2 < 3 /* and we indent like this */) {
this = the_way;
/* as to increase distinguishability of condition from body */
}
```
not
```c
if ( /* ... */
2 < 3) {
eyes = bleeding;
}
```
Conditional statements without `{ .. }` is okay (preferred) if the condition
fits on one line.
I.e. do
```c
if (1 /* short condition that fits on one line */)
u = the_best;
```
and
```c
if (the_variable_that_has_that_long_name = function_with_a_long_name_too(
arg_is_shorter_tho)) {
gesture = clapping;
}
```
## repository content
This repository contains:
* a library implementation of *sappho* called `spho`.
* a simple language parser (and soon type checker), called `msph`, developed in
tandem with `spho`.
* documentation of the sappho type system in `docs/`