-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Edis Hasaj edited this page Apr 21, 2023
·
1 revision
Welcome to the Struktogram-Creator wiki!
Here i will write a simple language specification for creating struktograms in my app.
All keywords consist of lowercase words followed by colons:
keyword:
And all blocks are closed by a corresponding keyword starting with 'end':
endkeyword:
The language ignores white space, but for readability it is encouraged to indent your blocks similarly as you would in Python.
Here is a list of the blocks you can use:
-
Sequence
- Sequences are the most basic building block of the language. If you type text in a line that does not start with a keyword, you have written a sequence. There is no support for merging sequences, but there is line break in the diagram for spaces.
-
Caption
- Captions are statements which are structured like this:
caption: (sequence)
- You can use this statement anywhere, but the program will only detect it's first non-nested usage. This statement is used to set a diagram caption
-
If
-
If blocks are structured like this:
-
if: sequence?\n (block, \n)* (else:\n (block, \n)*)? endif:
-
after the
if:
keyword you write a condition, and between theif:
andendif:
you write the blocks for the logic that will happen if the condition is true. You can also write an optionalelse:
block.
-
-
For
-
for: sequence?\n (block, \n)* endfor:
- This block is used to display an iteration whose condition is checked at the beginning of the loop (for/while). You write a condition after the
for:
keyword, and between for and endfor you write many blocks separated by newlines
-
-
Loop
-
loop: (block, \n)* endloop: sequence?
- This block is used to display an iteration whose condition is checked at the end of the loop (do-while in C). You write a condition after the
endloop:
keyword, and between loop and endloop you write many blocks separated by newlines
-
-
Break, Exit, Return
- All these blocks are similarly structured, and serve a similar purpose.
- Break: Break out of a loop (Can be used outside a loop as well, but why?)
break: sequence?
- Return: Return a value from a procedure
return: sequence?
- Exit: Exit the program with some value
exit: sequence?
- Break: Break out of a loop (Can be used outside a loop as well, but why?)
- All these blocks are similarly structured, and serve a similar purpose.
-
Call
- Used to visualize calling another procedure
call: sequence?
- Used to visualize calling another procedure
-
Concurrent
- Used to visualize different code blocks running in parallel. every individual block written inside a
concurrent:
block that is not in grouped in athread:
block is considered a thread of its own.-
concurrent:\n ((thread:\n block*) | block*)* endconcurrent:
-
-
thread:
blocks are used to group multiple blocks in one thread
- Used to visualize different code blocks running in parallel. every individual block written inside a