mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2026-03-11 19:37:07 +00:00
builtin functions partial fix
This commit is contained in:
parent
bad48a1da0
commit
e6a03ef9bf
7 changed files with 80 additions and 91 deletions
BIN
tests/.test_code.lang.kate-swp
Normal file
BIN
tests/.test_code.lang.kate-swp
Normal file
Binary file not shown.
|
|
@ -1,9 +1,9 @@
|
|||
// basic Float
|
||||
// basic Int
|
||||
// basic String
|
||||
// basic Char
|
||||
// basic Bool
|
||||
// basic Unit
|
||||
basic (Float : #Ord)
|
||||
basic (Int : #Ord)
|
||||
basic (String : #Ord)
|
||||
basic (Char : #Ord)
|
||||
basic (Bool : #Ord)
|
||||
basic Unit
|
||||
|
||||
//
|
||||
|
||||
|
|
@ -76,11 +76,11 @@ namespace var Ord {
|
|||
|
||||
//
|
||||
|
||||
// typeclass Print =
|
||||
// & var print : -> String
|
||||
//
|
||||
// typeclass Read =
|
||||
// & var read : String -> Read
|
||||
typeclass Show =
|
||||
& var show : -> String
|
||||
|
||||
typeclass Read =
|
||||
& var read : String -> Read
|
||||
|
||||
typeclass Debug =
|
||||
& debug : -> String
|
||||
|
|
@ -123,16 +123,16 @@ typeclass Enum =
|
|||
//
|
||||
|
||||
decl ( -- ) : Int -> Int -> Int_0
|
||||
// def ( -- ) : begin end = {
|
||||
// var current = begin
|
||||
// return (while current < end do {
|
||||
// ; current += 1
|
||||
// return current - 1
|
||||
// })
|
||||
// }
|
||||
def ( -- ) : begin end = {
|
||||
var current = begin
|
||||
return (while current < end do {
|
||||
; current += 1
|
||||
return current - 1
|
||||
})
|
||||
}
|
||||
|
||||
decl print : String -> Unit
|
||||
decl read : -> String
|
||||
decl scan : -> String
|
||||
|
||||
decl func : String -> Int
|
||||
def func : s = {
|
||||
|
|
@ -143,7 +143,7 @@ def func : s = {
|
|||
exec main {
|
||||
for i in (,0 ,1 ,2 ,3) do func: "abacaba"
|
||||
; print: ({
|
||||
if true then bring read: else { ; print: "aaa" }
|
||||
if true then bring scan: else { ; print: "aaa" }
|
||||
bring "nothing"
|
||||
; print: "aaa"
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue