Skip to content

CursedPrograms/syntaxia-structura

Repository files navigation

Twitter: @NorowaretaGemu License: MIT

C++ Win32 Git

Syntaxia & Structura

structarch

A deterministic, reactive, math-driven document system with a visual page-layout editor and an pdf-style document reader. Documents are saved as .syn files — a hybrid markup format where layout, logic, and styling coexist in one file. Styling is always embedded; there is no separate .strss file.

Language Overview

  • Syntaxia & Structura is a hybrid markup/programming language combining HTML-like structure with Python-style semantics and C-style operators.

.syn File Format

.syn files are self-contained — layout, logic, and styling are all embedded.

Core Syntax Rules

  1. Mandatory HTML-like tags for all code blocks
  2. Python-style indentation for internal blocks
  3. C-style operators: +, -, *, /, %, ==, !=, <, >, <=, >=, &, &&, |, ||, !
  4. Math symbols: π (Pi), (square root)
  5. Explicit type conversion: <>target_type==source_value<>
  6. Script references/imports: <@>other_script.syn</@>

Tags Reference

Tag Purpose
<@>filename.syn</@> Import/using another Syntaxia script
<func name="...">...</func> Define a function
<var name="..." type="...">value</var> Define variable
<if condition="...">...</if> Conditional block
<loop type="..." count="...">...</loop> Loop block
<print>expression</print> Output to console or UI
<>target_type==source_value<> Explicit type conversion

Applications

StructArch.exe — Page Layout Editor

Features

  • Physical page canvas — A4, A3, A5, Letter, Legal, Tabloid
  • Draw text boxes by clicking and dragging on any page
  • Select tool — click to select, drag to move, right-click or Delete to remove
  • Multi-page support — add and delete pages from the left panel
  • Properties panel — text content, font size, alignment (L/C/R), text colour, background colour, variable binding
  • HSV colour wheel picker with live hex #RRGGBB input
  • Zoom (Ctrl+scroll or toolbar buttons), fit-to-page
  • Saves and opens .syn files
  • Shortcuts: Ctrl+S save · Ctrl+O open · Ctrl+N new · Delete remove box · T text-box tool

SynReader.exe — Visual Document Reader

Features

  • Opens with a file picker if launched without arguments
  • Drag a .syn file directly onto the window
  • Pages rendered as physical white sheets on a dark slate background
  • Handles both StructArch layout format and modern Structura document format
  • Modern format (headings, paragraphs, tables, math blocks) is automatically reflowed onto pages
  • Zoom and scroll; ◀ ▶ page navigation; Home / End keys jump to first/last page
  • Status bar shows document title, author, page count, and current zoom

Page sizes

Name Width × Height
A4 210 × 297 mm
A3 297 × 420 mm
A5 148 × 210 mm
Letter 216 × 279 mm
Legal 216 × 356 mm
Tabloid 279 × 432 mm

Build

Requires MinGW (GCC 6+).

build.bat

Or manually:

g++ -std=c++14 -mwindows -O2 -static-libgcc -static-libstdc++ ^
    -o StructArch.exe maker\structarch.cpp ^
    -lcomctl32 -lcomdlg32 -lgdi32 -luser32 -luuid -lole32 -lshell32

g++ -std=c++14 -mwindows -O2 -static-libgcc -static-libstdc++ ^
    -o SynReader.exe renderer\synreader.cpp ^
    -lcomctl32 -lcomdlg32 -lgdi32 -luser32 -luuid -lole32 -lshell32

Both executables are fully self-contained — no external DLL dependencies.


Browser & Web

Chrome Extension — navigate to a .syn file in Chrome and it renders inline.

npm Package<SynDocument src={content} /> React component for web embedding.


Example Code

<structura version="1.0.4">
    <head>
        <@>math_utils.syn</@>
        
        <style>
            #Global {
                Palette: Temple16;
                Grid: 80x25;
                Resolution: 640x480;
                Surface: BLUE; /* Classic Setup Blue */
            }

            /* The Physics HUD style */
            #Field[name="distance"] {
                Surface: BLACK;
                Glyph: GREEN;  /* Radar/Monitor Green */
                Border: DOUBLE;
                At: 10CH, 5CH; /* Absolute position on the 80x25 grid */
            }

            /* Warning style if the object is moving too fast */
            [Condition: speed > 50.0] {
                Surface: RED;
                Glyph: WHITE;
                Signal: BLINK;
            }

            <<style ResultText>>
                Font: "FixedSys";
                Plane: 2;      /* Sits above the background */
                Shadow: DEEP;
            <>/style>>
        </style>
    </head>

    <func name="physics_demo">
        <var name="speed" type="float">9.8</var>
        <var name="time" type="float">5</var>
        <var name="distance" type="float">speed * time + 0.5 * 9.8 * time * time</var>

        <if condition="distance > 0 && speed > 0">
            <print style="ResultText">Distance traveled: distance</print>
        </if>

        <print>Half of π: π / 2</print>
        <print>Square root of 49: √49</print>

        <var name="distance_int" type="int"><~>int==distance<~></var>
        <print>Distance as integer: distance_int</print>
    </func>

    <call method="physics_demo" lock="true" />
</structura>


© Cursed Entertainment 2026

Releases

No releases published

Packages

 
 
 

Contributors