Skip to content
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:

  1. 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.
  2. 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
  3. 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 the if: and endif: you write the blocks for the logic that will happen if the condition is true. You can also write an optional else: block.

  4. 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
  5. 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
  6. 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?
  7. Call

    • Used to visualize calling another procedure
      • call: sequence?
  8. Concurrent

    • Used to visualize different code blocks running in parallel. every individual block written inside a concurrent: block that is not in grouped in a thread: 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
Clone this wiki locally