MCPcopy Create free account
hub / github.com/Gusabary/FlowChar

github.com/Gusabary/FlowChar @v1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.1 ↗ · + Follow
82 symbols 120 edges 11 files 0 documented · 0% updated 6y ago★ 5922 open issues

Browse by type

Functions 49 Types & classes 33
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

FlowChar

A tiny tool for conversion from pseudo-code to flowchart in character format.

Demo

pseudo-code:

be born;
while (alive) {
    if (happy) {
        smile;
    }
    else {
        try to be happy;
    }
}
die;

flowchart:

              +-------------+                   
              |   be born   |                   
              +-------------+                   
                     |                          
                     V                          
             N /-----------\                    
+--------------|   alive   |<------------------+
|              \-----------/                   |
|                    | Y                       |
|                    V                         |
|            Y /-----------\ N                 |
|         +----|   happy   |----+              |
|         |    \-----------/    |              |
|         |                     |              |
|         V                     V              |
|   +-----------+    +---------------------+   |
|   |   smile   |    |   try to be happy   |   |
|   +-----------+    +---------------------+   |
|         |                     |              |
|         +--------->O<---------+              |
|                    |                         |
|                    V                         |
|                    O-------------------------+
|                                               
|                                               
|               +---------+                     
+-------------->|   die   |                     
                +---------+                     

more demos

Usage

First clone the repository and build:

git clone https://github.com/Gusabary/FlowChar.git
cd FlowChar

# for linux
chmod +x ./build.sh
./build.sh

# for windows
.\build.bat

Then execute the binary with pseudo-code file and, optionally, output file specified. If no output file is provided, the emitted flowchart would be printed to stdout:

cd build
./flowchar -c ../examples/simple -o ../examples/simple-chart

Use -h option to get help:

./flowchar -h

Docker

Alternatively, pull a docker image and run with the directory including pseudo-file code mounted.

# from dockerhub
docker pull gusabary/flowchar:v1.0

# or from github
docker pull docker.pkg.github.com/gusabary/flowchar/flowchar:v1.0

# run
docker run -v /path/to/dir:/app/files gusabary/flowchar:v1.0 -c files/code -o files/chart

Note: the directory including pseudo-code file should be mounted as /app/files directory in the container.

A token may be needed if the image is pulled from github docker registry, here for reference.

Pseudo-code Syntax

Only sequential structure, branch structure controlled by if-else and loop structure controlled by while are supported now.

  • A string terminated with a semicolon is a statement, which will appear as a box in flowchart:

a; do this;

  • if keyword should be followed by condition wrapped in brackets and statement block wrapped in parenthesis:

if (condition) { statementA; statementB; }

Optionally, else keyword can be used with another statement block wrapped in parenthesis:

if (condition) { ok; } else { no; }

  • while keyword should be followed by condition wrapped in brackets and statement block wrapped in parenthesis:

while (condition) { loop; }

  • A statement block can be a composition of simple statements, if statements and while statements.

License

MIT

Last-modified date: 2020.5.17, 4 p.m.

Core symbols most depended-on inside this repo

browse all functions →

Shape

Method 41
Class 29
Function 8
Enum 4

Languages

C++100%

Modules by API surface

src/token.h12 symbols
src/box.cpp12 symbols
src/token.cpp11 symbols
src/box.h10 symbols
src/tree.cpp8 symbols
src/tree.h7 symbols
src/codeParser.cpp7 symbols
src/codeParser.h6 symbols
src/main.cpp5 symbols
src/chartEmitter.cpp3 symbols
src/chartEmitter.h1 symbols

For agents

$ claude mcp add FlowChar \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page