<commit_before># GRAIL-function-generator-in-Lisp
Automatically generates functions for abstract data types given their GRAIL representation.



## Motivation

Defining helper functions for abstract data types in symbolic computing tasks is repetitive and tedious. To alleviate this, the program allows the user to generate such functions automatically given the GRAIL syntax of the data types.



## Usage

GRAIL, short for GRAmmars In Lisp, is a notation format for abstract data types in Lisp, which extends Backus-Naur Form (BNF) by the addition of nonterminal argument names (Cameron and Dixon 1992). The program uses a functionally equivalent representation of GRAIL rules to automatically define functions relating to a given list of GRAIL rules.

To run the program, first move the file to the directory you wish to use the file in and run `(load "grail.lisp")` before running the program inside another program or a REPL. Then run the command `(grail grail-list)` where grail-list is a variable defined according to the following BNF syntax:

```
<grail-list>  ::= "'(" {<grail-rule>} ")"
<grail-rule>  ::= <assignment> | <alternation>
<assignment>  ::= "(" <type> " ::= " <s-exp> ")"
<alternation> ::= "(" <type> " ::= " <type> {<type>} ")"
<s-exp>       ::= <symbol> | <nonterminal> | "(" {<s-exp>} ")"
<type>        ::= "#(" <type-name> ")"
<nonterminal> ::= "#(" <arg-name> " " <type-name> ")"
<type-name>   ::= <symbol>
<arg-name>    ::= "" | <symbol>`
```<commit_msg>Minor changes<commit_after># GRAIL-function-generator-in-Lisp
Automatically generates functions for abstract data types given their GRAIL representation.



## Motivation

Defining helper functions for abstract data types in symbolic computing tasks is a repetitive and tedious ordeal. To alleviate this, the program allows the user to generate such functions automatically given the GRAIL syntax of the data types.



## Usage

GRAIL, short for GRAmmars In Lisp, is a notation format for abstract data types in Lisp, which extends Backus-Naur Form (BNF) by the addition of nonterminal argument names (Cameron and Dixon 1992). The program uses a functionally equivalent representation of GRAIL rules to automatically define functions relating to a given list of GRAIL rules.

To run the program, first move the file to the directory you wish to use the file in and run `(load "grail.lisp")` before running the program inside another program or a REPL. Then run the command `(grail grail-list)` where grail-list is a variable defined according to the following BNF syntax:

```
<grail-list>  ::= "'(" {<grail-rule>} ")"
<grail-rule>  ::= <assignment> | <alternation>
<assignment>  ::= "(" <type> " ::= " <s-exp> ")"
<alternation> ::= "(" <type> " ::= " <type> {<type>} ")"
<s-exp>       ::= <symbol> | <nonterminal> | "(" {<s-exp>} ")"
<type>        ::= "#(" <type-name> ")"
<nonterminal> ::= "#(" <arg-name> " " <type-name> ")"
<type-name>   ::= <symbol>
<arg-name>    ::= "" | <symbol>`
```
{'fraction_non_alphanumeric': 0.13454423141607805, 'fraction_numerical': 0.0026908846283215607, 'mean_word_length': 4.407272727272727, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6899969', 'n_tokens_mistral': 935, 'n_tokens_neox': 885, 'n_words': 363}