refactor/indentetion-oriented
README
- Syntax example:
- Planning:
Syntax example:
#this is what a struct delcaration shoul lool like
Point :: struct{
x: Numeric, # btw Numeric in my imagination is a Interface/Trai/Contrato comune to all numberic type
y: Numeric,
}
Point.new :: fn(x:Numeric, y:Numeric) Self:
return Point{x,y}
Point.sum :: fn(self, other: Point) Self:
return Point{x: self.x+other.x, y: self.y+self.y}
@(entrypoint)
main :: fn(parametro1: Numeric, parametro2: String) Void :
a := Point.new(67, 420)
b := Point.new(42, 47)
a = a.sum(b)
print("par: {},{}", touple(parametro1, parametro2))
if parametro1 == 0:
print("What do you epexted to happen?")
else if parametro1 > 0:
for i in range(0,parametro1,1):
print("{}", parametro2)
else:
for i in range(0,parametro1,-1):
print("{}", parametro2)
range_gen := precook(range, args: [0,parametro1]);
match parametro1 is:
== 0 => print("{}", parametro2),
> 0 => forEach(range_gen(1), |x| print("{}", parametro2)),
< 0 => forEach(range_gen(-1), |x| print("{}", parametro2)),
_ => panic()
match a is:
Point(x > 100, y) => print("YEAAA :)"),
_ => print("NAIH :(")
Planning:
allora quello che devo fare è:
TODO Controllare se ho finito la questione del return:label
TODO Complete the use os source slice inside parser (many node has synthetic source slice or badly wrapped)
TODO implement struct:
Cosa :: struct{
field1: Numeric
}
TODO update lexer
TODO update ast
TODO update parser
TODO implement partial function …
cosa := Cosa{feld1: 42}
function :: fn(self:Cosa, b: Numeric) -> Numeric
res := function(cosa,44)
TODO … to undirectly create method
res := cosa.function(44);
TODO … to make pipeline
res := cosa |> function(44);
TODO Understand what is a type system
TODO implement struct method:
Cosa.new :: fn(field1: Numeric):Self #+begin_src do
return Self{ field1 };
end;
Languages
Rust
100%