https://github.com/roguh/coolnoise
Parser and generator for programs written in the Classroom Object-Oriented Language. Eases testing of lexer and parser.
https://github.com/roguh/coolnoise
Last synced: about 1 year ago
JSON representation
Parser and generator for programs written in the Classroom Object-Oriented Language. Eases testing of lexer and parser.
- Host: GitHub
- URL: https://github.com/roguh/coolnoise
- Owner: roguh
- License: bsd-3-clause
- Created: 2016-09-17T23:06:35.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-10-03T15:50:31.000Z (over 9 years ago)
- Last Synced: 2025-01-26T04:42:08.533Z (over 1 year ago)
- Language: Cool
- Homepage:
- Size: 42 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE
Awesome Lists containing this project
README
# COOLNOISE
This Haskell code implements a parser and a generator for programs written in the
[COOL language](http://theory.stanford.edu/~aiken/software/cool/cool.html).
| File | Purpose |
|----------------|---------------------------------------------------------|
| `countCool.hs` | Counts the number of COOL expressions of a given depth. |
## Installation and Compilation
This project uses [stack](http://docs.haskellstack.org/en/stable/README/) and
the Haskell LTS 7.0 distribution. [Read these download and installation
instructions for stack.](https://docs.haskellstack.org/en/stable/install_and_upgrade/)
If you have not installed GHC 8.0.1 yet, run
```
stack setup
```
This command will download all dependencies and compile the project:
```
stack build
```
## Examples
### Lexer
After compiling the program, run the following command to see the help file:
```
stack exec coolnoise-exe -- --help
```
Use the `--file` option to lex a file:
```
stack exec coolnoise-exe -- --file cool_examples/hello_world.cl
```
You can also run the lexer on a string with the `--input` option:
```
stack exec coolnoise-exe -- --input '(* sample *) main() : SELF_TYPE { out_string("HI") };'
```
### Parser
### Generator
## Tests
None yet.
## Benchmarks
To benchmark the lexer, run
```
stack build
stack exec bench-cli -- --output benchmark.html
```
Open `benchmark.html` in a browser to see the results.
## Number of Expressions
There are at least 224,974,626 possible COOL untyped expression
that have depth of 4, and contain at most 7 subexpressions
(for example, a let-expression that binds 6 variables contains 7 subexpressions).
This table summarizes results with the same number of subexpressions:
| Depth | Number of COOL Expressions (not type checked) |
|-------|----------------------------|
| 0 | 6
| 1 | >= 747
| 2 | >= 36,978
| 3 | >= 2,884,290
| 4 | >= 224,974,626