Skip to content

Commit

Permalink
version 4.08 - fixed-point status checked
Browse files Browse the repository at this point in the history
  • Loading branch information
ycaseau committed Mar 12, 2023
1 parent 50add7d commit 6adf310
Show file tree
Hide file tree
Showing 37 changed files with 1,251 additions and 1,246 deletions.
5 changes: 3 additions & 2 deletions compile/gogen.cl
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ c_string(c:go_producer, self:symbol) : string
arg_match(go_signature(m2), %sig)
else true),
any (defined(m.selector.name) = Kernel & // v4.0.6: mix of methods & slot are not supported with Go
module!(m2) = Kernel))))), // we make an exception for Kernel methods
module!(m) = Kernel))))), // v4.0.7: we make an exception for Kernel methods
any false)) ]


Expand All @@ -290,7 +290,8 @@ c_string(c:go_producer, self:symbol) : string
case m2 (method (if (m2.module! = m.module! & c ^ m2.domain[1] != {})
arg_match(go_signature(m2), %sig)
else true),
any true)))))]
any (defined(m.selector.name) = Kernel & // v4.0.6: mix of methods & slot are not supported with Go
module!(m) = Kernel))))))] // we make an exception for Kernel methods


// same argument types for all restrictions, excluding the range (that is included in go_signature)
Expand Down
2 changes: 1 addition & 1 deletion compile/gomain.cl
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@

// create a directory for the module (if it does not exist)
[compile_dir(m:module): void
-> let s := "mkdir -p " /+ home() / "go/src" / capitalize(string!(m.name)) in
-> let s := "mkdir -p " /+ home() / "go" / "src" / capitalize(string!(m.name)) in
(if (home() = "") error("the environment variable CLAIRE_HOME is undefined\n"),
shell(s))]

Expand Down
2 changes: 1 addition & 1 deletion compile/gostat.cl
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ unfold_eid(ldef:list,self:any,s:class, v:any,err:boolean,loop:any) : void
g_eid_expression(x.args[2],object,lvar),
eid_expression(x.args[3],EID,lvar))
else if (x.arg.selector = nth_write)
printf("~I.WriteEID(~I,~I)",g_eid_expression(x.args[1],list),
printf("~I.WriteEID(~I,~I)",g_eid_expression(x.args[1],list,lvar),
g_eid_expression(x.args[2],integer,lvar),
eid_expression(x.args[3],EID,lvar))
else printf("~I.WriteEID(~I)",g_eid_expression(x.args[1],Variable,lvar),
Expand Down
53 changes: 35 additions & 18 deletions compile/log.cl
Original file line number Diff line number Diff line change
Expand Up @@ -692,38 +692,55 @@ car pmember({list<float>(0.2, 0.3, 0.5, 0.7)}) fails !!
thus the "simple" goMethod?(m) must check that no other restrictions is a slot (with intersecting domain)

(4) true compiler error with use of indirect read(p) where p = list[i]


TODO
enrich the Go unit tests !
// Jan 1st : MMS & EMLA OK + tests and perf

// when we restart : copy sclaire in a safe place and recompile everything

// =================== to do backlog v4.0.8 (Spring 2023)==========================================

gomain.cl -> dans mkdir, removed a direct use of / !!!!! (did not work on PC)

// New : add a reboot function in CLAIRE (useful to play with server)
// reboot() : recreate all objects (rebuild a clean state)

- ajouter la ligne de code dans le code généré pour claire1.go
(a) dans Load (à la fin)
C_reboot.AddMethod(Signature(C_void.Id(), C_void.Id()), 0, MakeFunction1(E_reboot_void, "reboot_void"))
(b) deux méthodes associées
func reboot_void() {
Bootstrap()
Load()
Reader.C_reader.Fromp = ClEnv.Cin
}
func E_reboot_void(s EID) EID {
reboot_void()
return EVOID
}

// enrich the Go unit tests !
// create a nice command to launch tests from the makefile
list:
- nth+(list<integer>(),1,1) = list<integer>(1)
- set!(list<float>(1.2)) = {1.2}
test Equal('a','a'), Equal('a','b'),

// add to code
- reset()
// before we make 4.08 a beta version, we need to test 3 more modules
- fbid (4G licence)
- SGSS (smart grid)
- SIFOA (not ready to put on github though)

// add to documentation
void is a superset of any (it is a compiler annotation: can return anything, should not be used
=> we need to explain this in the documentatation !
IT IS THE CONSEQUENCE OF ANY METHOD IS A FUNCTION THAT RETURNS A VALUE.
f() : void -> 12 is a good example.

// in the reference section
- exit(-1)
- princ("fff",6)
- module slots : import and resources (files that are needed)



// =================== to do backlog v4.0.8 (Spring 2023)==========================================

tester 2 autre modules clés, voire 3 (fbid)
- SGSS
- SIFOA

// extensions
- useversus % for belong
- play with spy
- imports is not used !!!
- talk about new 16 bits char in the claire documentation
- get rid of the test l.of == nil in a few weeks (once gwdg is compiled)
- dual definition of global constant should complain ?
- add something for methods with no errors but poor range ...
Expand Down
14 changes: 9 additions & 5 deletions compile/osystem.cl
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,15 @@ claire/DSHOW:boolean := false
And g_throw(self.args),
Or g_throw(self.args),
Call (self.selector != unsafe & (g_throw(self.args) | can_throw?(self.selector))),
Call_method (g_throw(self.args) |
(if (self.arg = *times_integer*) compiler.overflow?
else if (self.arg = *div_integer*) not(self.args[2] % integer & self.args[2] != 0)
else if (self.arg = *div_float*) not(self.args[2] % float & self.args[2] != 0.0)
else (self.arg != m_unsafe & notOpt(self) & self.arg.selector != externC & can_throw?(self.arg)))),
// V4.0.7 introduced special case for arithmetic overflow
Call_method ( if (self.arg = m_unsafe | notOpt(self) = false | self.arg.selector = externC) false
else if g_throw(self.args) true
else if (self.arg = *times_integer*) compiler.overflow?
else if (self.arg = *div_integer*)
(compiler.safety < 5 & not(self.args[2] % integer & self.args[2] != 0))
else if (self.arg = *div_float*)
(compiler.safety < 5 & not(self.args[2] % float & self.args[2] != 0.0))
else can_throw?(self.arg)),
Call_slot (g_throw(get(arg, self)) | (known?(test,self) & self.test)),
Call_table (g_throw(get(arg, self)) | (known?(test,self) & self.test)),
Call_array (g_throw(get(selector,self)) | g_throw(get(arg, self))),
Expand Down
7 changes: 4 additions & 3 deletions init.cl
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
*rsrc* :: "/Users/ycaseau/claire/v4.0/test/rules"

// these are the global variables expected by the compiler
RELEASE:float :: 0.07 // version of March 11th, 2022
RELEASE:float :: 0.08 // version of March 12th, 2023

// additions
/* // additions (comment out what you don't want)
begin(Core)
// claire/ephemeral_object <: object()
claire/ephemeral_object <: object()
end(Core)
begin(Optimize)
Expand All @@ -35,6 +35,7 @@ begin(Generate)
any g_expression(x,s)) ]
end(Generate)
*/ // end of additions

// ***************************************************************************
// * Part 1: Modules & compiler environment *
Expand Down
8 changes: 2 additions & 6 deletions meta/function.cl
Original file line number Diff line number Diff line change
Expand Up @@ -462,12 +462,8 @@ self_print(self:float) : void -> function!(print_float)
+(self:float,x:float) : float -> (self + x)
-(self:float,x:float) : float -> (self - x)
*(self:float,x:float) : float -> (self * x)
/(self:float,x:float) : float -> (self / x)
// old junk
// +(self:float,x:float) : float -> (let y:float := (self + x) in y)
// -(self:float,x:float) : float -> (let y:float := (self - x) in y)
// *(self:float,x:float) : float -> (let y:float := (self * x) in y)
// /(self:float,x:float) : float -> (let y:float := (self / x) in y)
/(self:float,x:float) : float -> unsafe(self / x) // v4.0.7 -> cross compiled function without error


-(self:float) : float -> (-1.0 * self)

Expand Down
Loading

0 comments on commit 6adf310

Please sign in to comment.