Module moto::ast

source ·

Re-exports§

Structs§

  • arrays are used to define a list of values e.g [1,2,3] or ["hello", "world"] or [true, false] tailing commas are allowed and ignored
  • assignments are used to define variables e.g let x = 5; or let x = "hello world"; or let x = true; or let x = [1,2,3]; or let x = {a:1, b:2}; or let x = 5 + 5; or let x = "hello" + "world"; identifier in gray = in yellow and value in green using ascii escape codes
  • binary operations are used to define operations between two atoms e.g 5 + 5 or "hello" + "world" or 5 + x or x + y or x + 5 or x + "hello" or "something" + [:x]
  • blocks are used to define reusable blocks of code e.g block developerCredits { developed by incredimo for xo.rs }:text
  • functions are used to reference a function e.g [:print("hello world")] or [:console.log("hello world")]
  • identifiers are used to define the name of a variable, task, runtime, block etc e.g in let x = 5; x is the identifier identifier always printed in bright yellow using ascii escape codes
  • imports are used to import code from other cells e.g import "math.moto" as math
  • objects are used to define a list of key value pairs e.g {a:1, b:2} or {name:"incredimo", age:30} tailing commas are allowed and ignored
  • operators are used to define operations between two atoms e.g + or - or * or / or == or != or > or < or >= or <= or && or ||
  • packages are used to define a package a package has multiple cells e.g package math { let x = 5; let y = 10; } or package math { task greet { echo "hello world" }:shell } or package math { runtime dart { let version = "3.7.0" }:shell } or package math { block developerCredits { developed by incredimo for xo.rs }:text } or package math { import "math.moto" as math }
  • runtimes are used to define a runtime for a specific language e.g `runtime dart { let version = “3.7.0” let path = “path/to/dart.exe”
  • tasks are used to define a sequence of commands e.g task greet { echo "hello world" }:shell or task greet { print("hello world"); }:dart or task greet { console.log("hello world"); }:js
  • variables are used to reference a value e.g [:name] or [:x=5] or [:x="hello"] or [:x=true] or [:x=[1,2,3]] or [:x={a:1, b:2}] default value is optional and can be omitted

Enums§

  • atoms things that return a value e.g 5 or "hello world" or true or [1,2,3] or {a:1, b:2} or 5 + 5 or "hello" + "world" or 5 + x or x + y or x + 5 or x + "hello" or "something" + [:x]