Call with something like:
> echo '11*19 + 3 * 9'|python exp2gviz.py -|dot -Earrowsize=0.4 -Nfixedsize=1 -Grankdir=BT -Tpng>gviz_out.png;feh gviz_out.png
To get something like:
| #lang racket/base | |
| (require | |
| racket/vector | |
| racket/match | |
| racket/class | |
| plot | |
| plot/utils | |
| data-frame | |
| ; These imports are structured this way here because of the way colors exposes |
| """ | |
| Shows the use of a python decorator that re-tries calling the decorated function up to N times, before allowing | |
| the **last** exception to propagate through. | |
| """ | |
| from functools import wraps | |
| from random import random | |
| def retry_or_die(N=5): | |
| def retry_or_die_factory(fn): | |
| @wraps(fn) |
| from neomodel import (config, StructuredNode, StringProperty, IntegerProperty, | |
| UniqueIdProperty, RelationshipTo, db) | |
| import os | |
| class Country(StructuredNode): | |
| code = StringProperty(unique_index=True, required=True) | |
| class City(StructuredNode): | |
| name = StringProperty(required=True) | |
| country = RelationshipTo(Country, 'FROM_COUNTRY') |
| """ | |
| A brief script to indicate the "location" of a possibly misspelled 'Washington' | |
| in the current (v1.20-2023-02-28-ror-data.json) ROR dataset | |
| :author: Athanasios Anastasiou | |
| :date: Mar 2023 | |
| """ | |
| import json |
| module stacklang_list::stacklang_list | |
| // A very simple stack language | |
| // | |
| // The stack is represented as a list with the top of the stack extending the list from the left. | |
| // For example, to add two numbers: eval([add(), push(1), push(1)]) | |
| import IO; | |
| // Symbols |
| """ | |
| A very small scheme-like language to try out the structural pattern matching | |
| features of python 3.11 | |
| Features: | |
| * Mathematical expressions +,-,*,/ involving integers, variables and functions | |
| * Functions are defined via lambda. | |
| * Values (including functions) are assigned to variables via let | |
| For more information regarding the concepts this language depends on, see: |
| """ | |
| Reads a Graphml file and instantiate the right type Networkx graph. | |
| Notes: | |
| 1. This is still work in progress. At its current state, the code will comfortably read "simple" graphml files. | |
| 2. The next step is to enable the routine to selectively read in (graph, node, edge) level data based on the | |
| namespace used. | |
| 3. This will probably be implemented with named tuples and it should support at least simple reads (if not full | |
| complex writes too). |
| """ | |
| This is a module that is supposed to be describing the whole datamodel of an application. | |
| NOTE: The directory structure that is implied here is: | |
| src/ | |
| app_models/ | |
| __init__.py (THIS FILE) | |
| main.py | |
| """ |