0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

自作プロトコルマークアップ言語 vmmj言語の紹介

Last updated at Posted at 2020-01-05

前回シールド言語の評価が良かったのでそれのサブ言語としてプロトコルとデータ記述用言語があれば便利がいいと思い作ってみました。

名前はVMMJ言語です。暗号化するとVMMJS言語となりインタプリタにより解読されます。

ex.vmmj
<@ コレハコメントデス@>
@コレモコメントデス
Includes !vmmjs://#aegialina/lang/shield/dats/vak <@ Includes !vak_freamworkでもOK@> @既にタグが定義されている
Includes !vmmjs://#aegialina/lang/shield/dats/withshield <@ Includes !vak_shield_coreでもOK@>
Call 始めよう -newGls
ecro !コレハテストデス
give with Get_Dir !Vak.shie begin
set width,height to 797,931 @データ受け渡しset 名前 to 数値 空リストを渡すときはset 名前 to ,
set sizeini to Nil
end
<@主な演算子vmmjsにおけるもの(他言語におけるもの) 
set~to(代入) eq(==) add(+) addto(+=) pull(-) pullto(-=) prod(*) prodto(*=) div(/)divto(/=) pow(べき乗) powto(べき乗=)
noeq(!=) gt(>) gteq(>=) lt(<) lteq(<=) and(and/&&) or(or/||) xor(xor/^^) not(not/!) 
シールド言語よりも少なめなので覚えやすい@>
@データ作成
set dats 1
set dats2 !Fine @文字列
plus
set A to Red.ads #adsで自身の名前を取得
get A #!Red
van Lists(to 40) @40ノリスト空の場合 make List(要素最小値 to 要素最大値) as 型名(List(デフォルト),Tuple等) 初期値 to 最終値
set That For lst in Lists to Nil
set Tuples to Nil @空オブジェクト
set Tuples to van T(10 to 40) as Tuple @後から入れることも可能
@主な型Integer,Boolean,Character(0以上の数),String,Double,Object,Variant,List,Tuple,Array,Type_Nil(基本は省略可能限定時は必要)
@if関数
set dats to If dats2 eq !Fine Then 3 Elseif dats 2 Then 5 Else Then !Ham end
@for関数
set Lists(That) For i in nList(5) to If i is dats Then True else Then False end next
@こちらを推奨
=>set Lists(with 5 do i) i is dats when True default False next
@zip set start 値 with 値 set step 値モアル
@while関数 
set i to 0
set 値 to While Lists(i) is not True Do pass Next else ret i End
[!My_shield_core](!vmmjs://#aegialina/lang/shield/dats/withshield)
[!Window Title]<!Vak.shies`title>
fun Myfun -Gls,a begin @最初必ず制御文を確認するタメ-NewGlsガヒツヨウ
-Gls ret a add 5
end fun
def Newtag has protocol is option attribute is Nil @タグノサクセイ
Newtag !新しいタグ
def Newtag2 has protocol is option attribute eq has_end @タグノサクセイ
Newtag2 begin
	!新しいタグ
Newtag2 end 
Newtag2 begin !新しいタグ Newtag2 end @一行で書くこともできる
Call 終わろう -newGls
def Newtag3 has protocol is option attribute set restriction to value is gt 5
van ListA(to 30)
set ListA(with 30 do i) when RNDFLT() * 10 next @10以下の浮動小数点
ecro ListA as L do when L is #Newtag3 next @ハッシュタグ(中に条件つきタグを入れることができる)when前置き表記
ecro ListA(#Newtag3) @上と同じ結果になる。

見てわかると思うのですが,全てはタグ,コマンド,関数でできているため,非常に分かりやすいですよね。簡易xmlとしても機能します(htmlに対するMarkdown)。シールドスクリプトに埋め込んでメイン処理をシールド言語側で処理させることもできます。簡易処理を書くことができるのも長所です。

var0.1

getコマンドを許可しました(安全に処理が可能です)。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?