Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
12e5f221
Commit
12e5f221
authored
Jan 01, 2020
by
Maxime Perrotin
Browse files
Add a bit of documentation
parent
63d5e28c
Changes
1
Hide whitespace changes
Inline
Side-by-side
design/parser.md
0 → 100644
View file @
12e5f221
These notes explain how to load a model and render it as a statachart
This can be done for example using ptpython3
# Import the opengeode library to access the parser
import opengeode
# Make sure Qt is initialized to render the model
app = opengeode.init_qt()
# Parse a model
ast, _, _ = opengeode.ogParser.parse_pr(['model.pr'])
# ast is of type opengeode.ogAST.AST (check ogAST.py)
# Extract the SDL process
process = ast.processes[0] # type: opengeode.ogAST.Process
# Create a scene and a view to render the process as a statechart
scene = opengeode.SDL_Scene('statechart')
view = opengeode.SDL_View(scene)
# Transform the AST of the process into a graphviz graph
graph = opengeode.Statechart.create_dot_graph(process, basic=True)
# Then render the graph (requires graphviz)
opengeode.Statechart.render_statechart(scene, graph)
# Enable the view and run the application
view.show()
app.exec_()
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment