Skip to content

Commit

Permalink
Fix about page
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanBrouwer committed Aug 18, 2024
1 parent 009db4d commit a0b3be7
Showing 1 changed file with 1 addition and 51 deletions.
52 changes: 1 addition & 51 deletions prism-compiler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,6 @@

## About

This crate provides a PEG parser with the following features:
* Support for left recursion
* Adaptation: The grammar can be changed dynamically during parsing
Prism is a dependently typed programming language with an adaptive grammar.

This crate is under heavy development and not yet ready to be used in production code.


## Example
This defines the grammar of a simple arithmetic language, and support to adapt the language:
```
rule start = block;
rule block {
b <- "grammar" "{" g:grammar(prule_action) "}" ";" b:#adapt(g, block);
s :: b <- s:stmt ";" b:block;
[] <- "";
}
rule stmt {
Let(e) <- "let" e:expr;
Do() <- "do";
}
rule expr {
group additive {
Add(x, y) <- x:#next "+" y:#this;
}
group multiplicative {
Mul(x, y) <- x:#next "*" y:#this;
}
group base {
Block(b) <- "(" b:block ")";
UnaryMinus(v) <- "-" v:#this;
Num(n) <- n:#str([0-9]*);
}
}
rule layout = [' ' | '\n'];
```

Example programs in this language:
```
1 * 2 + -3
```
```
grammar {
rule expr {
group additive {
1 + (-2) <- x:#next "-" y:#this;
}
}
};
1 - 2
```

0 comments on commit a0b3be7

Please sign in to comment.