From 2b0fb7eef490b35554963085dad6c500d3e9b187 Mon Sep 17 00:00:00 2001 From: Igor Dejanovic Date: Wed, 25 Oct 2023 10:44:32 +0200 Subject: [PATCH] docs: various smaller fixes --- README.md | 6 +++--- docs/src/builders.md | 15 ++++++++------- docs/src/docs_setup.md | 4 ++-- docs/src/grammar_language.md | 2 +- docs/src/tutorials/calculator/calculator.md | 2 +- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 43b30b65..8ac388e7 100644 --- a/README.md +++ b/README.md @@ -93,10 +93,10 @@ Be sure to check [Rustemo book](https://igordejanovic.github.io/rustemo/)! - [x] Disambiguation filters: priorities, associativities. - [x] Rule/production meta-data. E.g. production kinds. - [x] CLI and API. A `rcomp` compiler CLI is available that can be called on - Rustemo grammars. Also an API enables integrating parser compiling into - Rust `build.rs` scripts. See [the calculator + Rustemo grammars. Also, API enables integrating parser code generation + into Rust `build.rs` scripts. See [the calculator example](./examples/calculator/) or [integration tests](./tests/). -- [x] Tracking of position and reporting error with line/column works. +- [x] Tracking of position and reporting error with line/column. - [x] Support for a layout (comments, whitespaces given as CFG). It is implemented as a special grammar rule and parsed by the LR parser. Result is passed by context to actions which can do whatever they please. E.g. a diff --git a/docs/src/builders.md b/docs/src/builders.md index a2c09b60..38e7bd40 100644 --- a/docs/src/builders.md +++ b/docs/src/builders.md @@ -9,7 +9,7 @@ Currently Rustemo can be configured with three builder types: When default builder is used, Rustemo will perform type inference for Abstract-Syntax Tree (AST) node types based on the grammar. The builder, AST - types and actions for creating instances of AST nodes will be generated. + types, and actions for creating instances of AST nodes will be generated. - **Generic tree builder** @@ -27,8 +27,9 @@ following a certain set of rules explained in this section. The generated builder will then call into actions to produce instances of the AST types. The final output of this builder is AST tailored for the given grammar. -The builder will be generated inside `.rs` file where `` is the name -of the grammar. The actions will be generated into `_actions.rs` file. +The builder will be generated, together with the parser, inside `.rs` file +where `` is the name of the grammar. The actions will be generated into +`_actions.rs` file. ```admonish note There are two approaches where generated files are stored. See [the configuration section](./configuration.md). @@ -68,7 +69,7 @@ be: 3. Multiple content matches and/or assignments -> a `struct` type where fields types are of the referred symbols. -In addtion, production kinds and assignments LHS names are used for +In addition, production kinds and assignments LHS names are used for fields/function/type naming. Also, cycle refs are broken using `Box`. Probably the best way to explain is by using an example. For example, if we have @@ -161,8 +162,8 @@ builder from scratch. To provide a custom builder you start with a type that implements a `rustemo::Builder` trait and after that implements a concrete parsing algorithm -trait. Currently, Rustemo is a LR parser thus you can use `rustemo::LRBuilder` -trait. +trait. Currently, Rustemo is a (G)LR parser thus you can use +`rustemo::LRBuilder` trait. Let's see how can we do all of this by implementing a builder that does on-the-fly calculation of the arithmetic expression. Start with a type and a @@ -183,7 +184,7 @@ For example, given the grammar: ``` -in file `custom_builder.rustemo` the following builder from file +in the file `custom_builder.rustemo`, the following builder from file `custom_builder_builder.rs` will perform arithmetic operation on-the-fly (during parsing): diff --git a/docs/src/docs_setup.md b/docs/src/docs_setup.md index 4f7077e8..1f930b3b 100644 --- a/docs/src/docs_setup.md +++ b/docs/src/docs_setup.md @@ -56,7 +56,7 @@ For UML diagrams we use [PlantUML](https://plantuml.com/), while for general gra # Trees diagrams -For tree diagrams LaTeX (pdflatex) with qtree package is used to produce PDF and -afterwards the PDF file is converted to PNG using `pdftoppm`. See +For tree diagrams LaTeX (`pdflatex`) with `qtree` package is used to produce PDF +and afterwards the PDF file is converted to PNG using `pdftoppm`. See `docs/build-latex-images.sh` script. This script must be called whenever `.tex` files with trees description are changed. diff --git a/docs/src/grammar_language.md b/docs/src/grammar_language.md index 0226acfc..e54d2cc7 100644 --- a/docs/src/grammar_language.md +++ b/docs/src/grammar_language.md @@ -791,7 +791,7 @@ This will be parsed correctly: for a=10 to 20 -As `=` is not matched by the `KEYWORD` rule and thus doesn’t require to be +As `=` is not matched by the `KEYWORD` rule and thus doesn't require to be separated from the surrounding tokens. ```admonish note diff --git a/docs/src/tutorials/calculator/calculator.md b/docs/src/tutorials/calculator/calculator.md index 8446dadc..5af3d6a3 100644 --- a/docs/src/tutorials/calculator/calculator.md +++ b/docs/src/tutorials/calculator/calculator.md @@ -2,7 +2,7 @@ ```admonish note This tutorial assumes that you have Rustemo CLI properly installed. Refer to -section Installation if you have trouble running `rcomp` command. +the [CLI section](../../cli.md) if you have trouble running `rcomp` command. ```