Skip to content

Eidolang language reference

Eidolang is the text representation of an Eidograph figure. A figure is one script: commands create objects, expressions establish dependencies, and style and animation remain in the same text. Dragging, canvas tools, and property changes ultimately write back to this script.

This page describes only the current language, Eidolang 0.2; it contains no retired syntax. For complete runnable scripts, visit example projects.

Script skeleton

Every script should begin with a space declaration:

txt
space plane
version 0.2

# One command per line; # starts a comment
point A -2 0
point B 2 0
segment base A B
point M = midpoint(A, B)
  • space plane selects the 2D dialect; space solid selects the 3D dialect.
  • version 0.2 is optional. It is the language version, not the .eido manifest version.
  • Names are case-sensitive and must be defined before use.
  • Bare angle literals are radians; write degree values explicitly, such as 45deg.
  • Strings use double quotes. Colors may use forms such as #3366cc.

Freedom model

Every geometry object belongs to exactly one tier:

TierDefinitionBehavior
FreeCoordinates or values are literalDrag directly or edit in the properties panel
BoundUses on … at … or local coordinates against a carrierMoves only on its carrier
DerivedUses an = expression based on other objectsCannot be dragged; updates when inputs change
txt
point A 0 0                    # free
point P on c at 0.25           # bound
point M = midpoint(A, P)        # derived

Shared values and expressions

Scalar expressions support + - * / ^, parentheses, comparisons, and boolean operations. Constants include pi, tau, and e; common functions include sin, cos, tan, sqrt, abs, min, max, and distance/vector functions.

Object properties can feed later expressions, such as base.length, c.radius, and poly.area. let stores any expression value, while fn defines a function for plots or surfaces:

txt
let half = base.length / 2
fn wave(x) = sin(x) * half
plot graph wave domain -6 6

Invalid values do not crash the app. Diagnostics report the source location and reason, while downstream objects become invalid or warning records.

Plane (2D) commands

Construct basic objects

ComponentCommon forms
Pointpoint A x y, point P on path at t, point M = expr
Linearsegment s A B, line l A B, ray r A B, vector v A B
Circlecircle c O radius r, circle c O through A
Ellipse and arcellipse e F1 F2 through P, arc a P1 P2 P3
Polygonpolygon tri A B C
Standard constructionsmidpoint M A B, parallel p A l, perpendicular p A l
Intersectionsintersections xs pathA pathB

Intersection results are list<point>. Prefer stable selectors such as xs.nearest(A), xs.maxY, or xs.minX; the order behind xs[0] may change during motion.

Paths, functions, and regions

txt
plot graph sin domain -6 6
curve loop (cos(t), sin(t)) t from 0 to tau samples 160
polar rose (2*cos(3*a)) a from 0 to tau
equation unit x^2 + y^2 = 1
locus trace P driver u samples 180

region disk = c
region lens = intersection(c1, c2)

Segments, lines, rays, circles, ellipses, arcs, function plots, and loci implement Path behavior. They can carry bound points, intersect one another, and be composed with subpath and pathjoin.

Transforms and frames

txt
point Q = reflect(P, axis)
rotate tri2 tri around O by 30deg
translate c2 c by (2, -1)
scale big tri around O by 2

frame f O X
point L in f 1 0.5

reflect, rotate, translate, and scale are available both as expression functions and commands. Similarity transforms preserve object types where possible.

Solid (3D) commands

txt
space solid
point3 O 0 0 0
point3 T 0 0 3
sphere ball O radius 2
cylinder body O T radius 1
ComponentCommon forms
Points and linespoint3, segment3, line3, ray3, vector3
Planes and spheresplane ground A B C, sphere s O radius r
Solidsbox, prism, pyramid, cylinder, cone
Framesframe3 f O X Y, point3 P in f x y z
Space curvescurve3, locus3
Function surfacessurface waves f domain x0 x1 y0 y1
Intersectionsintersections3, plane_intersect_line, sphere_intersect_sphere
Transformsreflect3, rotate3, translate3, scale3

In 3D, a point can bind to a segment, line, ray, or sphere surface. A sphere point uses two parameters:

txt
point3 P on ball atAngles 45deg 90deg

box, prism, pyramid, cylinder, and cone expose measures such as .volume, .surfaceArea, and .centroid. curve3 and locus3 are sampled display objects and are not currently carriers for bound points.

Parameters, animation, and stages

txt
param r 1 range 0.5 4 step 0.1
circle c O radius r
animate r duration 2s mode pingpong

stage result duration 1.2s reveal draw
show c transition draw duration 0.8s
  • param creates a slider in the Params panel.
  • animate supports loop, pingpong, and once.
  • stage creates sequential presentation steps; show, hide, clear, and reveal modes control presence.
  • 2D playback, 3D playback, and GIF export share the same timeline.

Presentation commands

txt
style base stroke #3366cc width 2 opacity 0.9
label base text "given segment"
textbox note -4 3 width 5 height 2 text "Drag A or B"
group helpers A B base
hide helpers transition fade duration 0.5s

style controls color, fill, width, opacity, and point/arrow sizes; 2D also supports dash patterns. Label text wrapped completely in $$…$$ is rendered as LaTeX. textbox is 2D-only.

Macros and assertions

txt
def bisect(A, B) -> (M, b) {
midpoint M A B
perpendicular_bisector b A B
}

use bisect P Q -> M1 b1
assert dist(P, M1) == dist(M1, Q) tolerance 1e-6 note "M1 is midpoint"

def/use reuse a construction and isolate its internal names during expansion. assert checks a relationship and produces a warning; it does not constrain or solve the figure.

Query exact signatures in the app

This page organizes commonly used commands by purpose. For exact, complete signatures from the installed version:

  • use help in the Eidolang editor;
  • ask the in-app Agent to call list_commands;
  • call the same tool from an external MCP/REST client.

The returned list comes directly from the active dialect's parser registry, so it stays aligned with the installed build.