@@ -56,15 +56,15 @@ Letter = UnicodeLetterCategory ;
5656### Keywords
5757
5858``` ebnf
59- Keyword = "fn" | "let" | "global" | "if" | "else" | "while" | "for" | "loop"
59+ Keyword = "fn" | "let" | "global" | "if" | "else" | "while" | "for" | "loop"
6060 | "return" | "true" | "false" | "once" | "namespace" ;
6161```
6262
6363### Operators
6464
6565``` ebnf
66- Operator = ".." | "+" | "-" | "*" | "/" | "%"
67- | "=" | "==" | "!=" | "<" | ">" | "<=" | ">="
66+ Operator = ".." | "+" | "-" | "*" | "/" | "%"
67+ | "=" | "==" | "!=" | "<" | ">" | "<=" | ">="
6868 | "&&" | "||" | "!" | "."
6969 | "->" | "+=" | "-=" | "*=" | "/=" | "%=" | "..="
7070 | "++" | "--" ;
@@ -164,6 +164,7 @@ HatBlock = Expression BlockStatement ;
164164```
165165
166166Examples:
167+
167168``` fuse
168169event.start { /* statements */ }
169170event.keyPressed("space") { /* statements */ }
@@ -273,8 +274,8 @@ FactorExpression = UnaryExpression ( ("*" | "/" | "%") UnaryExpression )* ;
273274
274275UnaryExpression = ( ("+" | "-" | "!") UnaryExpression ) | CallExpression ;
275276
276- CallExpression = PrimaryExpression ( "(" ArgumentList? ")" [ BlockStatement ]
277- | "[" Expression "]"
277+ CallExpression = PrimaryExpression ( "(" ArgumentList? ")" [ BlockStatement ]
278+ | "[" Expression "]"
278279 | "." Identifier )* ;
279280
280281PrimaryExpression = Literal
@@ -321,6 +322,7 @@ The FUSE program structure allows only the following at the top level:
321322### Type System
322323
323324FUSE uses a simple type system:
325+
324326- ` void ` : No return value
325327- ` any ` : Any Scratch value (string, number, boolean)
326328- ` bool ` : Boolean values (` true ` or ` false ` )
@@ -342,16 +344,19 @@ The `@export` decorator is used to export Scratch blocks.
342344### Operators
343345
344346#### Arithmetic Operators
347+
345348- ` + ` : Addition
346349- ` - ` : Subtraction
347350- ` * ` : Multiplication
348351- ` / ` : Division
349352- ` % ` : Modulo
350353
351354#### String Operators
355+
352356- ` .. ` : String concatenation
353357
354358#### Comparison Operators
359+
355360- ` == ` : Equal
356361- ` != ` : Not equal
357362- ` < ` : Less than
@@ -360,21 +365,25 @@ The `@export` decorator is used to export Scratch blocks.
360365- ` >= ` : Greater than or equal
361366
362367#### Logical Operators
368+
363369- ` && ` : Logical AND
364370- ` || ` : Logical OR
365371- ` ! ` : Logical NOT
366372
367373#### Assignment Operators
374+
368375- ` = ` : Assignment
369376- ` += ` , ` -= ` , ` *= ` , ` /= ` , ` %= ` , ` ..= ` : Compound assignment
370377
371378#### Increment/Decrement
379+
372380- ` ++ ` : Increment by 1
373381- ` -- ` : Decrement by 1
374382
375383### Control Flow
376384
377385#### If-Else
386+
378387``` fuse
379388if (condition) {
380389 // statements
@@ -384,20 +393,23 @@ if (condition) {
384393```
385394
386395#### While Loop
396+
387397``` fuse
388398while (condition) {
389399 // statements
390400}
391401```
392402
393403#### For Loop
404+
394405``` fuse
395406for (init; condition; update) {
396407 // statements
397408}
398409```
399410
400411#### Infinite Loop
412+
401413``` fuse
402414loop {
403415 // statements
@@ -407,11 +419,13 @@ loop {
407419### Function Calls
408420
409421Functions can be called with arguments:
422+
410423``` fuse
411424functionName(arg1, arg2, arg3)
412425```
413426
414427Some Scratch blocks can have a "then" block:
428+
415429``` fuse
416430someBlock(args) {
417431 // then statements
@@ -421,6 +435,7 @@ someBlock(args) {
421435### Member Access
422436
423437Access namespace members or object properties:
438+
424439``` fuse
425440namespace.property
426441object.method(args)
@@ -505,7 +520,7 @@ fn processArray() once -> void {
505520### exportal Blocks
506521
507522``` fuse
508- @export("custom block [arg1] and [arg2]")
523+ @export("custom block [arg1] and [arg2]")
509524fn customBlock(arg1: any, arg2: any) once -> any {
510525 return arg1 + arg2
511526}
@@ -533,8 +548,8 @@ Target = FunctionDeclaration | VariableDeclaration ;
533548HatBlock = Expression BlockStatement ;
534549
535550(* Statements *)
536- Statement = VariableDeclaration | AssignmentStatement | IncrementStatement
537- | IfStatement | WhileStatement | ForStatement | LoopStatement
551+ Statement = VariableDeclaration | AssignmentStatement | IncrementStatement
552+ | IfStatement | WhileStatement | ForStatement | LoopStatement
538553 | ReturnStatement | BlockStatement | ExpressionStatement | NoopStatement ;
539554
540555AssignmentStatement = Expression AssignmentOperator Expression Eol ;
0 commit comments