Skip to main content
Sign in
Snippets Groups Projects
Commit eb29b9a1 authored by Johannes Mey's avatar Johannes Mey
Browse files

add parser page

parent 2140fdad
No related branches found
No related tags found
No related merge requests found
Pipeline #12784 passed
...@@ -2,22 +2,24 @@ ...@@ -2,22 +2,24 @@
A testbed for a potential *motion grammar*[^1] implementation using JastAdd. A testbed for a potential *motion grammar*[^1] implementation using JastAdd.
## Description ## Introduction
The motion grammar describes the Load/Unload scenario from Dantam[^1]. The point of this very simple grammar was *not* The motion grammar describes the Load/Unload scenario from Dantam[^1]. The point of this very simple grammar was *not*
to show how motion grammars work, but rather the expressiveness of a CFG (compared to a regular grammar), but it is very to show how motion grammars work, but rather the expressiveness of a CFG (compared to a regular grammar), but it is very
simple, so it serves as a starting point. simple, so it serves as a starting point.
## Grammar
![](diagrams/grammar/uml.png) ![](diagrams/grammar/uml.png)
The structure grammar is shown (after building the project) in `src/gen/resources/diagrams/grammar/uml.png`. It The grammar comprises three parts. `MotionGrammar` contains generic nonterminals present in every motion
comprises three parts. `MotionGrammar` contains generic nonterminals present in every motion grammar, `LoadUnload` has grammar, `LoadUnload` has the actual nonterminals of the grammar, and `World` describes the context within which the
the actual nonterminals of the grammar, and `World` describes the context within which the grammar is parsed. grammar is parsed.
Currently, the parser reads a sequence of `Load`, `Unload`, and `Full` tokens and loads a `Container` with up to ten Currently, the parser reads a sequence of `Load`, `Unload`, and `Full` tokens and loads a `Container` with up to ten
elements. elements.
There are not attributes used so far, but at each point where a semantic action takes place, the AST is printed to a There are no attributes used so far, but at each point where a semantic action takes place, the AST is printed to a
file in `src/gen/resources/diagrams/parsing`, demonstrating the "available" part of the AST, which could be used by file in `src/gen/resources/diagrams/parsing`, demonstrating the "available" part of the AST, which could be used by
attributes. attributes.
... ...
......
# Parsing the Load/Unload World
| Action | World | Motion Grammar |
|--------|---------------------------------------------------------------------------------|------------------------------------------------------------------------|
| | ![](diagrams/parsing/Context-World-000-initial.png) | |
| Load | ![](diagrams/parsing/Context-World-001-parseLoad.png) | ![](diagrams/parsing/AST-001-parseLoad.png) |
| Load | ![](diagrams/parsing/Context-World-002-parseLoad.png) | ![](diagrams/parsing/AST-002-parseLoad.png) |
| Load | ![](diagrams/parsing/Context-World-003-parseLoad.png) | ![](diagrams/parsing/AST-003-parseLoad.png) |
| Full | ![](diagrams/parsing/Context-World-004-parseFull.png) | ![](diagrams/parsing/AST-004-parseFull.png) |
| T2 | ![](diagrams/parsing/Context-World-005-parseT2.png) | ![](diagrams/parsing/AST-005-parseT2.png) |
| T | ![](diagrams/parsing/Context-World-006-parseT.png) | ![](diagrams/parsing/AST-006-parseT.png) |
| Unload | ![](diagrams/parsing/Context-World-007-parseUnload.png) | ![](diagrams/parsing/AST-007-parseUnload.png) |
| T1 | ![](diagrams/parsing/Context-World-008-parseT1.png) | ![](diagrams/parsing/AST-008-parseT1.png) |
| T | ![](diagrams/parsing/Context-World-009-parseT.png) | ![](diagrams/parsing/AST-009-parseT.png) |
| Unload | ![](diagrams/parsing/Context-World-010-parseUnload.png) | ![](diagrams/parsing/AST-010-parseUnload.png) |
| T1 | ![](diagrams/parsing/Context-World-011-parseT1.png) | ![](diagrams/parsing/AST-011-parseT1.png) |
| T | ![](diagrams/parsing/Context-World-012-parseT.png) | ![](diagrams/parsing/AST-012-parseT.png) |
| Unload | ![](diagrams/parsing/Context-World-013-parseUnload.png) | ![](diagrams/parsing/AST-013-parseUnload.png) |
| T1 | ![](diagrams/parsing/Context-World-014-parseT1.png) | ![](diagrams/parsing/AST-014-parseT1.png) |
| T | ![](diagrams/parsing/Context-World-015-parseT.png) | ![](diagrams/parsing/AST-015-parseT.png) |
| | ![](diagrams/parsing/Context-World-016-complete.png) | ![](diagrams/parsing/AST-016-complete.png) |
...@@ -3,7 +3,8 @@ repo_url: https://git-st.inf.tu-dresden.de/jastadd/motion-grammar-example ...@@ -3,7 +3,8 @@ repo_url: https://git-st.inf.tu-dresden.de/jastadd/motion-grammar-example
site_dir: ../public site_dir: ../public
nav: nav:
- "Motion Grammar Example": index.md - "Overview": index.md
- "Parsing Example": parsing.md
- "API documentation": ragdoc/index.html - "API documentation": ragdoc/index.html
theme: theme:
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment