Update syntax.md
This commit is contained in:
parent
79c54f3c0d
commit
0b637d6870
|
@ -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)]
|
||||
```
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue