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:
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 planeselects the 2D dialect;space solidselects the 3D dialect.version 0.2is optional. It is the language version, not the.eidomanifest 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:
| Tier | Definition | Behavior |
|---|---|---|
| Free | Coordinates or values are literal | Drag directly or edit in the properties panel |
| Bound | Uses on … at … or local coordinates against a carrier | Moves only on its carrier |
| Derived | Uses an = expression based on other objects | Cannot be dragged; updates when inputs change |
point A 0 0 # free
point P on c at 0.25 # bound
point M = midpoint(A, P) # derivedShared 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:
let half = base.length / 2
fn wave(x) = sin(x) * half
plot graph wave domain -6 6Invalid 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
| Component | Common forms |
|---|---|
| Point | point A x y, point P on path at t, point M = expr |
| Linear | segment s A B, line l A B, ray r A B, vector v A B |
| Circle | circle c O radius r, circle c O through A |
| Ellipse and arc | ellipse e F1 F2 through P, arc a P1 P2 P3 |
| Polygon | polygon tri A B C |
| Standard constructions | midpoint M A B, parallel p A l, perpendicular p A l |
| Intersections | intersections 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
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
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.5reflect, rotate, translate, and scale are available both as expression functions and commands. Similarity transforms preserve object types where possible.
Solid (3D) commands
space solid
point3 O 0 0 0
point3 T 0 0 3
sphere ball O radius 2
cylinder body O T radius 1| Component | Common forms |
|---|---|
| Points and lines | point3, segment3, line3, ray3, vector3 |
| Planes and spheres | plane ground A B C, sphere s O radius r |
| Solids | box, prism, pyramid, cylinder, cone |
| Frames | frame3 f O X Y, point3 P in f x y z |
| Space curves | curve3, locus3 |
| Function surfaces | surface waves f domain x0 x1 y0 y1 |
| Intersections | intersections3, plane_intersect_line, sphere_intersect_sphere |
| Transforms | reflect3, rotate3, translate3, scale3 |
In 3D, a point can bind to a segment, line, ray, or sphere surface. A sphere point uses two parameters:
point3 P on ball atAngles 45deg 90degbox, 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
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.8sparamcreates a slider in the Params panel.animatesupportsloop,pingpong, andonce.stagecreates sequential presentation steps;show,hide,clear, and reveal modes control presence.- 2D playback, 3D playback, and GIF export share the same timeline.
Presentation commands
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.5sstyle 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
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.
