<commit_before># CSP
CSP is a language by <NAME> for a process algebra that describes
patterns of interaction. The language is specified in the book
_Communicating Sequential Processes_, published by Prentice Hall 1985,
ISBN 0-13-153289, which is fortunately available online in an updated
version: <http://www.usingcsp.com/>.

The book itself provides sections that give directions how various
operators can be implemented in LISP. This package is such an
implementation, albeit based on C++ and yacc, that supports a small
subset of CSP. A utility is provided that allows to interactively follow
possible traces or to check non-interactively for a process _P_ if a
trace is member of _traces_(_P_).

## Downloading and building

Cloning should be done recursively:

```
git clone --recursive https://github.com/afborchert/csp.git
```

To build it, you need _bison_ 3.x and a recent _g++_ with
C++14 support:

```
cd csp/csp
make depend
make
```

## Lexical symbols

### Comments
The commenting style of Ada and C is supported:
* For single-line comments `//` or `--` can be used which extend to the end of the line.
* Comments can be enclosed in `/*` and `*/`.

### Identifiers and keywords
Following identifiers and keywords are used by the grammar:

| Symbol    | Description                                      | Regular expression
| --------- | ------------------------------------------------ | --------------------
| *PROCESS* | identifier that begins with an upper case letter | `[A-Z][A-Za-z0-9_]*`
| *EVENT*   | identifier that begins with a lower case letter  | `[a-z][A-Za-z0-9_]*`
| *ALPHA*   | keyword "alpha" (must be lower case)             | alpha
| *RUN*     | keyword "RUN" (must be upper case)               | RUN
| *STOP*    | keyword "STOP" (must be upper case)              | STOP
| *SKIP*    | keyword "SKIP" (must be upper case)              | SKIP

### Operators
Following operators are supported and presented in the order of precedence,
those with the highest precedence coming first:

| Operator             | Description          | Associativity   | Section
| -------------------- | -------------------- | --------------- | -------
| `(`...`)`            | grouping             |                 |
| `\`                  | concealment          | non-associative | 3.5
| `->`                 | prefix               | right-to-left   | 1.1.1
| &#124;~&#124;        | non-deterministic or | left-to-right   | 3.2
| `[]`                 | general choice       | left-to-right   | 3.3
| &#124;&#124;&#124;   | interleaving         | left-to-right   | 3.6
| &#124;&#124;         | concurrency          | left-to-right   | 2.3
| `;`                  | sequence             | left-to-right   | 5.1
| `=`                  | definition           | non-associative | 1.1

The right-to-left prefix operator `->` (see section 1.1.1) is
right-associative and must be used within parentheses, possibly
in combination with the `|` operator (see section 1.1.3) which
must be used with prefix expressions only.

The sections refer to the book by <NAME>.

### Delimiters

* Alphabets are enclosed in `{` ... `}`.
* Multiple members of an alphabet are separated by commas: `,`

## Grammar
The grammar represents a subset of CSP:

   _Unit_ &#8594; _ProcessDefinitions_ | _ProcessExpression_ | _ProcessExpression_ _ProcessDefinitions_

   _ProcessDefinitions_ &#8594; _ProcessDefinition_ | _ProcessDefinitions_ _ProcessDefinition_

   _ProcessDefinition_ &#8594; *PROCESS* `=` _ProcessExpression_ | *PROCESS* _Alphabet_ `=` _ProcessExpression_

   _ProcessExpression_ &#8594; _ProcessSequence_

   _ProcessSequence_ &#8594; _ParallelProcesses_ | _ProcessSequence_ `;` _ParallelProcesses_

   _ParallelProcesses_ &#8594; _InterleavingProcesses_ | _ParallelProcesses_ `||` _InterleavingProcesses_

   _InterleavingProcesses_ &#8594; _ExternalChoice_ | _InterleavingProcesses_ `|||` _ExternalChoice_


   _ExternalChoice_ &#8594; _InternalChoice_ | _ExternalChoice_ `[]` _InternalChoice_

   _InternalChoice_ &#8594; _ConcealedProcessExpression_ | _InternalChoice_ `|~|` _ConcealedProcessExpression_

   _ConcealedProcessExpression_ &#8594; _SimpleProcessExpression_ | _SimpleProcessExpression_ `\` _Alphabet_

   _SimpleProcessExpression_ &#8594; *PROCESS* | *RUN* _Alphabet_ | *RUN* *ALPHA* *PROCESS* | *STOP* _Alphabet_ | *STOP* *ALPHA* *PROCESS* | *SKIP* _Alphabet_ | *SKIP* *ALPHA* *PROCESS* | `(` _ProcessExpression_ `)` | `(` _Choices_ `)`

   _Choices_ &#8594; _PrefixExpression_ | _Choices_ `|` _PrefixExpression_

   _PrefixExpression_ &#8594; *EVENT* `->` _ProcessExpression_ | *EVENT* `->` _PrefixExpression_

   _Alphabet_ &#8594; `{` `}` | `{` _AlphabetMembers_ `}`

   _AlphabetMembers_ &#8594; *EVENT* | _AlphabetMembers_ `,` *EVENT*

# Usage
The _trace_ command expects a filename as last argument and supports following flags:
<commit_msg>CHAOS added to README<commit_after># CSP
CSP is a language by <NAME> for a process algebra that describes
patterns of interaction. The language is specified in the book
_Communicating Sequential Processes_, published by Prentice Hall 1985,
ISBN 0-13-153289, which is fortunately available online in an updated
version: <http://www.usingcsp.com/>.

The book itself provides sections that give directions how various
operators can be implemented in LISP. This package is such an
implementation, albeit based on C++ and yacc, that supports a small
subset of CSP. A utility is provided that allows to interactively follow
possible traces or to check non-interactively for a process _P_ if a
trace is member of _traces_(_P_).

## Downloading and building

Cloning should be done recursively:

```
git clone --recursive https://github.com/afborchert/csp.git
```

To build it, you need _bison_ 3.x and a recent _g++_ with
C++14 support:

```
cd csp/csp
make depend
make
```

## Lexical symbols

### Comments
The commenting style of Ada and C is supported:
* For single-line comments `//` or `--` can be used which extend to the end of the line.
* Comments can be enclosed in `/*` and `*/`.

### Identifiers and keywords
Following identifiers and keywords are used by the grammar:

| Symbol    | Description                                      | Regular expression
| --------- | ------------------------------------------------ | --------------------
| *PROCESS* | identifier that begins with an upper case letter | `[A-Z][A-Za-z0-9_]*`
| *EVENT*   | identifier that begins with a lower case letter  | `[a-z][A-Za-z0-9_]*`
| *ALPHA*   | keyword "alpha" (must be lower case)             | alpha
| *CHAOS*   | keyword "CHAOS" (must be upper case)             | CHAOS
| *RUN*     | keyword "RUN" (must be upper case)               | RUN
| *STOP*    | keyword "STOP" (must be upper case)              | STOP
| *SKIP*    | keyword "SKIP" (must be upper case)              | SKIP

### Operators
Following operators are supported and presented in the order of precedence,
those with the highest precedence coming first:

| Operator             | Description          | Associativity   | Section
| -------------------- | -------------------- | --------------- | -------
| `(`...`)`            | grouping             |                 |
| `\`                  | concealment          | non-associative | 3.5
| `->`                 | prefix               | right-to-left   | 1.1.1
| &#124;~&#124;        | non-deterministic or | left-to-right   | 3.2
| `[]`                 | general choice       | left-to-right   | 3.3
| &#124;&#124;&#124;   | interleaving         | left-to-right   | 3.6
| &#124;&#124;         | concurrency          | left-to-right   | 2.3
| `;`                  | sequence             | left-to-right   | 5.1
| `=`                  | definition           | non-associative | 1.1

The right-to-left prefix operator `->` (see section 1.1.1) is
right-associative and must be used within parentheses, possibly
in combination with the `|` operator (see section 1.1.3) which
must be used with prefix expressions only.

The sections refer to the book by <NAME>.

### Delimiters

* Alphabets are enclosed in `{` ... `}`.
* Multiple members of an alphabet are separated by commas: `,`

## Grammar
The grammar represents a subset of CSP:

   _Unit_ &#8594; _ProcessDefinitions_ | _ProcessExpression_ | _ProcessExpression_ _ProcessDefinitions_

   _ProcessDefinitions_ &#8594; _ProcessDefinition_ | _ProcessDefinitions_ _ProcessDefinition_

   _ProcessDefinition_ &#8594; *PROCESS* `=` _ProcessExpression_ | *PROCESS* _Alphabet_ `=` _ProcessExpression_

   _ProcessExpression_ &#8594; _ProcessSequence_

   _ProcessSequence_ &#8594; _ParallelProcesses_ | _ProcessSequence_ `;` _ParallelProcesses_

   _ParallelProcesses_ &#8594; _InterleavingProcesses_ | _ParallelProcesses_ `||` _InterleavingProcesses_

   _InterleavingProcesses_ &#8594; _ExternalChoice_ | _InterleavingProcesses_ `|||` _ExternalChoice_


   _ExternalChoice_ &#8594; _InternalChoice_ | _ExternalChoice_ `[]` _InternalChoice_

   _InternalChoice_ &#8594; _ConcealedProcessExpression_ | _InternalChoice_ `|~|` _ConcealedProcessExpression_

   _ConcealedProcessExpression_ &#8594; _SimpleProcessExpression_ | _SimpleProcessExpression_ `\` _Alphabet_

   _SimpleProcessExpression_ &#8594; *PROCESS* | *CHAOS* _Alphabet_ | *CHAOS* *ALPHA* *PROCESS* | *RUN* _Alphabet_ | *RUN* *ALPHA* *PROCESS* | *STOP* _Alphabet_ | *STOP* *ALPHA* *PROCESS* | *SKIP* _Alphabet_ | *SKIP* *ALPHA* *PROCESS* | `(` _ProcessExpression_ `)` | `(` _Choices_ `)`

   _Choices_ &#8594; _PrefixExpression_ | _Choices_ `|` _PrefixExpression_

   _PrefixExpression_ &#8594; *EVENT* `->` _ProcessExpression_ | *EVENT* `->` _PrefixExpression_

   _Alphabet_ &#8594; `{` `}` | `{` _AlphabetMembers_ `}`

   _AlphabetMembers_ &#8594; *EVENT* | _AlphabetMembers_ `,` *EVENT*

# Usage
The _trace_ command expects a filename as last argument and supports following flags:

{'fraction_non_alphanumeric': 0.13359707851491176, 'fraction_numerical': 0.025157232704402517, 'mean_word_length': 2.863244514106583, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '691652', 'n_tokens_mistral': 3142, 'n_tokens_neox': 2863, 'n_words': 928}