LoginSignup
1
1

More than 3 years have passed since last update.

シールド言語var0.1

Last updated at Posted at 2020-01-28

シールド言語var 0.1

この言語はPython,C#,Kotlin,vの良いなと思ったところを取り込んだ自作言語です。拡張性が高く速度もJava並みJitのようにメモリ使用は多くなく並列化も難しくありません。

ex.shie
using Sys
using Os <-Os.ptr,Os.Pointer.Nullptr,Os.Pointer.thisptr,Os.Pointer.ID,Os.Pointer.Out,Os.Environment.Exit等
using Collection #<- class Enumerable,class Range,class Array,class List(デフォルト),class Dict,class...
from Sys using static Console
from Sys using Environment <-Exit,
from Sys using static Math
delegate file as files //関数別名

static class ex():
    def do_File() ():
        opt var t = 1
        opt f float = Null
        lst = new int [[1,2,3],[6,7,2,4],[7,10,24,66,13]] #リスト
        lst1 = new int [10,30]
        lst2 = new [[val = for(x in Range(10)) if(x == 4 and y == 6) break] for(y in Range(10))]
        itg := 1 #イミュータブル ERROR itg = 3
        string := "VVAN.png"
        opt fstring str = Os.File.Is_Pass(string) #パスがない場合None Unit
        if (not fstring):
            return #自動でNone Unit
        else:
            WriteLine(string+"は" + fstring"に存在します")
            return 

    pub def Main(Matual_Girls str):
        WriteLine(ex.do_File()) #staticオブジェクト参照はオブジェクト名.でアクセス。普通の場合はthis.でアクセス out->None
        ex.mycls = cls() 
        ex.mycls.show()

struct stl:
    pub def _init():
        pub self.x = 500
        pub self.y = 400
        pub self.z = 0

class cls():
    pub def _init():
        get set del this.mylist = [for(i in Range(10)) if(i%3 is _Nothing()) 1 elif(i%2 is _Nothing()) 2 else Null] //elseの時はNull

    pub def show():
        WriteLine(for(l in this.mylist))
        get set del opt this.stl_s stl = Null

if(_name == "__main__"):
    ex.Main()

(*
    変数は オプション 変数名 型 = 変数
    メンバーオブジェクトアクセスはself.~,this.~
    Unit型(C++でいうnullptr_t型)はNoneとNullのみ。普通のメソッドはNoneを返す。ジェネリクス等でWhere selfと書くと値型で非staticなものWhere struct と書くと全ての値型が取り出される。Unit型は特殊で、Unit classと書くとNoneのみUnit struct と書くとNullのみ。Where t is false と書くと_Nothing()値が選ばれる。
    ジャンプ命令はbreak(##<T>),continue(##<T>),return,yield,yield break,yield continueがある。
*)

シールド言語の仕組み

事前コンパイル(スタティックリンク)->jcpファイル生成(コンテナで動くファイル)->コンテナ(ダイナミックリンク/GC/プラットフォーム間の特異点を吸収)->Jitコンパイル->実行で動く言語VMと比べてCPU/メモリ使用量が少ないので良い。速度はJava程度の能力があるようにしたて出ししたいので後悔しませんね?って言われてもはいと答えましょうか。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1