From 0b637d6870660dc4baa567aa67aa214507ac12f1 Mon Sep 17 00:00:00 2001 From: Lauchmelder Date: Sat, 27 Nov 2021 22:59:21 +0100 Subject: [PATCH] Update syntax.md --- src/doc/syntax.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/doc/syntax.md b/src/doc/syntax.md index c01cdf1..b66f171 100644 --- a/src/doc/syntax.md +++ b/src/doc/syntax.md @@ -1,15 +1,21 @@ # Syntax ``` -point(3 | 4) -> A -point(6 | 7) -> B +[point(3, 4) -> A] +point(6, 7) -> B line(A, B) -> AB -line(0 | 0, 100 | 100) +line(point(0, 0), point(100, 100)) circle(A, len(AB)) ``` +## Behaviour +Every line is one instruction. It is possible to assign instructions names to re-use them later. +These variables are immutable. Objects do not exist in this script, in fact, variables are more similar to C-style macros than actual variables. + +Lines in brackets `[]` are "hidden". They are parsed, but will not be rendered. + ## Primitives * `Point point(x, y)` is a 2D point. It returns an element of type `Point` * `Line line(Point from, Point to)` is a straight line. It returns an element of type `Line`. @@ -21,4 +27,4 @@ instruction ::= identifier({parameter, }) [-> identifer] parameter ::= instruction | identifier | number identifier ::= (A-Za-z) number ::= (0-9)[.(0-9)] -``` \ No newline at end of file +```