From 74527f68d6c3550eb29e3f7ac48d3b891d9fb07d Mon Sep 17 00:00:00 2001 From: Lauchmelder Date: Sun, 28 Nov 2021 07:40:44 +0100 Subject: [PATCH] Update syntax.md --- src/doc/syntax.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/doc/syntax.md b/src/doc/syntax.md index a8039d7..173f3ac 100644 --- a/src/doc/syntax.md +++ b/src/doc/syntax.md @@ -4,7 +4,7 @@ [point(3, 4) -> A] point(6, 7) -> B -line(A, B) -> AB +line[color=red, weight=4](A, B) -> AB line(point(0, 0), point(100, 100)) circle(A, len(AB)) @@ -16,6 +16,12 @@ These variables are immutable. Objects do not exist in this script, in fact, var Lines in brackets `[]` are "hidden". They are parsed, but will not be rendered. +It is possible to add an optional set of parameters in front of each parameter list, in order to specify the appearance of the element. + +## Primitives vs Functions +Primitives (e.g. `point`, `line`) and Functions (e.g. `len`, `intersection`) are syntactically indistinguishable. +Both can be used as parameters or instructions and can be assigned to variables. The only difference is that Primitives generate a visual output (unless they are surrounded by square brackets) + ## Grammar ``` instruction ::= identifier({parameter, }) [-> identifer]