mirror of
https://github.com/BoardWare-Genius/jarvis-models.git
synced 2025-12-13 16:53:24 +00:00
doc: Runtime readme.md
This commit is contained in:
16
runtime/READMD.md
Normal file
16
runtime/READMD.md
Normal file
@ -0,0 +1,16 @@
|
||||
# Runtime
|
||||
一台VM運行時,用於隔離租戶環境與服務器環境,提供腿本用於調用模型流。
|
||||
# 語法
|
||||
```
|
||||
// 使用//註解
|
||||
// "雙引號字符串"
|
||||
let s = "hello"
|
||||
// 整數
|
||||
let i = 10
|
||||
// 浮點數
|
||||
let f = 1.2
|
||||
// 動態類型
|
||||
s = i
|
||||
// 返回值
|
||||
return s
|
||||
```
|
||||
@ -60,14 +60,7 @@ class Runtime:
|
||||
def variable_declaration(self, ast):
|
||||
id = ast.get("identifier").get("name")
|
||||
v = ast.get("value")
|
||||
if self._is_literal(v):
|
||||
l = self.literal(v)
|
||||
if l != None:
|
||||
self.records[id] = l
|
||||
else:
|
||||
raise Exception("Unknown literal type: " + v.get("type"))
|
||||
if self._is_identifier(v):
|
||||
self.records[id] = self.records.get(v.get("name"))
|
||||
self.records[id] = self.unquote(v)
|
||||
|
||||
def literal(self, ast):
|
||||
if ast.get("type") == "StringLiteral":
|
||||
|
||||
Reference in New Issue
Block a user