Skip to content

Commit

Permalink
Revert "removed examples because they crash the tutor due to bootstra…
Browse files Browse the repository at this point in the history
…pping reasons"

This reverts commit 6dadd63.
  • Loading branch information
jurgenvinju committed Jun 21, 2023
1 parent 6024915 commit 800c6c3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/org/rascalmpl/library/ParseTree.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,26 @@ For any concrete grammar, a.k.a. reified syntax type, `g` it holds that:
In other words, a loaded parser function behaves exactly as a freshly generated parser
for the same grammar, if (and only if) it was stored for the same grammar value.
}
@examples{
First we store a parser:
```rascal-shell
import ParseTree;
syntax E = E "+" E | "e";
storeParsers(#E, |test-temp:///E.parsers|)
```
Here we show a new shell does not even know about the grammar:
```rascal-shell,errors
#E
```
Then in a next run, we load the parser and use it:
```
import ParseTree;
p = loadParsers(|test-temp:///E.parsers|);
p(type(sort("E"), ()), "e+e", |src:///|);
}
@benefits{
* loaded parsers can be used immediately without the need of loadig and executing a parser generator.
}
Expand Down

0 comments on commit 800c6c3

Please sign in to comment.