Skip to content
This repository was archived by the owner on Aug 9, 2020. It is now read-only.

Syntax ideas

Mario Montoya edited this page Aug 8, 2020 · 6 revisions

Basic Types

Numeric type

  • All integers are 64-bits.

Syntax: 1

  • All floating-point data are 64-bits.

Syntax: 1.1f

  • For money data type use decimals.

Syntax: 1.1d

Boolean type

  • True value:

Syntax: true

  • False value:

Syntax: false true false not and or < <= <>

Strings type

  • All strings are UTF-8 encoding guaranteed. You could delimiter strings with double-quotes or an apostrophe.

Using double-quotes if you want to escape apostrophes.

Syntax: "hello 'wonderful' world!"

Using apostrophes if you want to escape double-quotes.

Syntax: 'hello "wonderful" world!'

  • You could use triple quotes for multiline strings.

Syntax:

"""hello from
multiline world!"""

"hello {1 + 2}"

dates

dt"2001-01-10T23_02_10"
d"2001-01-10"
t"23_02_10"

Collections

Vectors

nums = Vec[it:i32;1, 2, 3]
nums = 1
nums = [1]

Tables

Fac = Map[| key id:i32, code, cust, salesman|] //header/type

Map = [|
  id:i32, name:Str;
  1, "hello"; //row0
  2, "world" //row1
|]

Tree = [<
  id:Int = 1, 2; //col0
  name:Str = "hello", "world" //col1
>]
city =  Map[| id:i32, pk code, cust, salesman|]

city = Tree[| id:i32, code, pk name, salesman|]

Tuples/Rows

named:

city = | id=1,  name="miami" |


anon:

city = | 1, "miami" |

Structures

Enumerators

enum Color do
  Blue: Int
  Red: (String, String)
  Green

Named Relations

rel City do
  pk id:Int
  name:Str

Name conventions

Color types
COLOR const
color vars
color_blue 

Indexing

Numeric

[1, 2, 3] # 0
[1, 3, 4] # [0, 2] = [1, 4]

Named columns

city #name #id
city ?select #name

Casting & Conversions

if is a:Vec[Int] do
  let a = cast a:Vec[Int]

Functions

[1, 3, 4] .map .filter .print

save(city)
city.save()