Wip: struct parsign
This commit is contained in:
+11
-5
@@ -17,21 +17,27 @@ Cosa :: struct{
|
|||||||
field1: Number
|
field1: Number
|
||||||
}
|
}
|
||||||
#+end_src
|
#+end_src
|
||||||
*** TODO update lexert
|
*** TODO update lexer
|
||||||
*** TODO update ast
|
*** TODO update ast
|
||||||
*** TODO update parser
|
*** TODO update parser
|
||||||
** TODO implement partial function ...
|
** TODO implement partial function ...
|
||||||
#+begin_src rlox
|
#+begin_src rlox
|
||||||
cosa := make(Cosa, feld1: 42)
|
cosa := Cosa{feld1: 42}
|
||||||
function :: fn(self:Cosa, b: Number) -> Number
|
function :: fn(self:Cosa, b: Number) -> Number
|
||||||
res := function(cosa,44)
|
res := function(cosa,44)
|
||||||
#+end_src
|
#+end_src
|
||||||
*** TODO ... to undericlty create method
|
*** TODO ... to undirectly create method
|
||||||
#+begin_src rlox
|
#+begin_src rlox
|
||||||
res := cosa.function(44)
|
res := cosa.function(44);
|
||||||
#+end_src
|
#+end_src
|
||||||
*** TODO ... to make pipeline
|
*** TODO ... to make pipeline
|
||||||
#+begin_src rlox
|
#+begin_src rlox
|
||||||
res := cosa |> function(44)
|
res := cosa |> function(44);
|
||||||
#+end_src
|
#+end_src
|
||||||
** TODO Understand what is a type system
|
** TODO Understand what is a type system
|
||||||
|
** TODO implement struct method:
|
||||||
|
#+begin_src rlox
|
||||||
|
Cosa.new :: fn(field1: Number):Self #+begin_src do
|
||||||
|
return Self{ field1 };
|
||||||
|
end;
|
||||||
|
#+end_src
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use crate::{
|
|||||||
common::{
|
common::{
|
||||||
ast::{AstNode, Expr},
|
ast::{AstNode, Expr},
|
||||||
base_value::{BaseValue, LoxFunction, Struct},
|
base_value::{BaseValue, LoxFunction, Struct},
|
||||||
lox_result::{LoxResult, parse_error, runtime_error},
|
lox_result::{parse_error, runtime_error, LoxResult},
|
||||||
types::Type,
|
types::Type,
|
||||||
},
|
},
|
||||||
frontend::{
|
frontend::{
|
||||||
|
|||||||
Reference in New Issue
Block a user