Karasic编程语言

你好朋友。


如您所知,每个受人尊敬的编码器迟早都会编写自己的记录器,json解析器和编程语言。既然我们已经写了第一本书和第二本书,我们别无选择,只能用新的创新编程语言karasic展示我们的成就。



如您所知,世界并没有停滞不前。编程语言的发展还不完整。每年都会出现新的语言,对人类进行特征基因测试,将其传给后代并死亡,有些是早一些,有些是后一种。任何一种新语言中的大多数创新,与其说是新的发展,还不如说是现有观念的演变和对旧方法的重新思考。


在构建karasic时,我们受到了两个公认的项目的启发,例如rust,python,c ++,wolfram和实验示例(例如dcastf,glink,whitespace等),它们的权威性并不低,但同样受到启发。


因此,让我们开始分析为您带来的功能,因为这就是方法。


权利分配语法


, , , , ( ) .


:


  • mov, .
  • , strcpy, memmove, .

, :


  • cp, ln.
  • std::copy .

, , , , , , ...


, . . , . - , .


karasic :


42 => answer
foo(42) => answer

, . , .


: - -:



, :


42 => answer = 42

,


, , , , , . karasic , .


<typing:dynamic> //    

fn foo(a,b) //   
{
    a + b => c
    return c
}

fn bar(a:i32,b) //       
{   
    a + b => c
    return c
}

[typing:static] //     
fn fubar(a:i32,b:i32) -> i32 //   
{
    a + b => c : i32
    return c

    //    :
    // a + b => return
    // a + b
}

, - , , ( jit ). , . ( , ).


karasic . , . , , , , , , :




karasic , , , whitespace. , go, , , , , .


karasic !


    a + foo(b) => c // 
    a + foo(b) => c // 

, . . ,


try {
    foo();
}
catch (...) {}

, . . , . -- .



, ( ), karasic .


, try-catch


try {
    throw Exception(42);
} catch ex {
    print(ex.value)
    exit(0)
}

, result-


fn foo() -> result(i32) 
{
    return Exception(42)
}

karasic , , tryso, , , stack_overflow.


tryso {
    throw Exception(42)
}

tryso_explicit, , stack_overflow, .


tryso_explicit {
    throw Exception(42)
}

force_retry, , .


force_retry {
    throw Exception(42)
}


smart_try, , .


smart_try {
    throw casdcasd sdfsadf Exception(42) //     .
}

, shallow_throw(N), N .


shallow_throw(n) Exception(42)

, , - .



. , karasic, , , , - . , karasic O(1). karasic ( ) , , karasic .



, karasic , . , , karasic , . karasic , , .



, . , . .


karasic.



, , , . , , gpu.


, .


, , .


.


, karasic , -, lua, python . karasic .


python:


import python3:numpy as np

fn main() 
{
    np.arange([42,41,40]) => arr
    np.log10(arr)
}

:


import clang:string.h as cstring
import clang:stdlib.h as cstdlib

fn main() 
{
    raw_buffer(cstdlib.malloc(40),40) => buf0
    cstring.strcpy(buf0, "HelloWorld")

    println(buf0) // HelloWorld
}

, , , . , , , , , , .




karasic ,


RFC1149


import rfc1149

fn main() 
{
    rfc1149.datagramm("HelloFriend") => dgramm
    rfc1149.send_bird("-  .12.  ,   ,  17  20.00", dgramm)
}

RFC2795


import rfc2795

fn main() 
{
    rfc2795.monkey("Jonh") => jonh
    rfc2795.monkey("George") => george
    rfc2795.monkey("Stephen") => stephen

    rfc2795.monkey_group([jonh, george]) => jonh_and_george

    "" => sonnet    
    do  
    {
        jonh_and_george.make_sonnet(66) => sonnet
    } while(stephen.do_critic(sonnet) is false)

    println(sonnet)

    /*

    Tired with all these, for restful death I cry,
    As, to behold desert a beggar born,
    And needy nothing trimm'd in jollity,
    And purest faith unhappily forsworn,
    And guilded honour shamefully misplaced,
    And maiden virtue rudely strumpeted,
    And right perfection wrongfully disgraced,
    And strength by limping sway disabled,
    And art made tongue-tied by authority,
    And folly doctor-like controlling skill,
    And simple truth miscall'd simplicity,
    And captive good attending captain ill:

    Tired with all these, from these would I be gone,
    Save that, to die, I leave my love alone. 

    */
}

.



, , . IT . karasic , , , , karasic , . , karasic, Junior Karasic Developer, Middle Karasic Developer, , Senior Karasic Developer.


karasic . , !


, .



(c)由Karasic inc。提供。


普通cru鱼





UPD:英文文本


All Articles