Files
Viper_VRTE/builtins.vp
T
2026-08-27 10:16:28 +08:00

26 lines
711 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import t
# ============================================================
# 内置函数(Python 语义,自动与 builtins 关联,无需显式 import)
# ord: 字符 → ASCII 码(int)
# chr: ASCII 码 → 字符(t.CChar)
# min/max: 数值比较取小/大值(double 参数,int/float 实参经
# coerce_to_type 无损提升;返回值由调用侧 coerce 到目标类型)
# ============================================================
def ord(s: t.CChar) -> int:
return s
def chr(i: int) -> t.CChar:
return i
def min(a: double, b: double) -> double:
if a < b:
return a
return b
def max(a: double, b: double) -> double:
if a > b:
return a
return b