喵撲宇宙

喵嗚(Mew,@meow 8.0)的前端(從詞法到展開)已經完成,可以在實驗場試寫;還沒有執行階段,也沒有任何已出貨的宿主,喵撲的主題工坊今天用的是 @meow 6.0。

診斷代碼

格式

診斷文字是英文,因為它會被整段貼回任何外部 AI。Studio 的介面再包一層在地化的說明。每一則:

E-NAM-001  line 31, col 6: unknown name `socre`
   31 |   if socre > save.best { save.best = state.score }
      |      ^^^^^
  expected: a local, a `state.` field, a top-level `let`, a param or a builtin
  did you mean: `state.score` (state, line 12)
  fix: replace `socre` with `state.score`.
前綴意思
E-錯誤:不能安裝
W-警告:可以安裝
N-正規化紀錄:前端已經把一種外來的寫法改成標準寫法
R-執行期:需要 VM

還沒有東西會產生的代碼。 下列代碼需要目前不存在的階段(VM、繪圖清單、著色器發射器、舊路徑的 schema 與對比規則、分享碼),現在不會出現:R-FUEL、R-DRAW、R-AREA、W-RUN-001、W-RUN-002、W-RUN-003、W-A11Y-001、W-A11Y-002、E-SAF-003、E-SAF-004、E-SAF-005、W-SAF-006、W-CON-001、E-PKG-001、E-PKG-002、E-SHD-005、E-SHD-006、E-SHD-009、E-SHD-010、W-SHD-001、W-SHD-002、E-BUD-005、N-NRM-021。

規格也沒有替幾種情況指定代碼:沒有 @meow 行的檔案、超過 32 字元的識別字、超過 20 000 個語法樹節點(未驗證)、base 的非法值。這些都是規格未定(LANGUAGE.md §2.1、§3.2、§3.4)。

常見的代碼

下面是新手最常碰到的幾則,每一則有意思、最小的失敗範例和改法。其餘代碼在本頁最後的完整目錄。

規格沒有寫清楚的代碼

完整目錄

下面每一個代碼都有自己的錨點(#E-XXX-nnn),由前端的診斷表產生;上面寫過說明的代碼,說明會併進來。

E-VER-001 錯誤

unsupported header version

W-VER-002 警告

header version is 9.0 or later but the content is the old grammar; handled on the legacy path

E-VER-003 錯誤

the header is the abandoned, never shipped `@meow 7.x` draft

檔頭是已經廢棄、從未出貨的 @meow 7.x 草稿。前端不解析內容。

@meow 7.0

layout { }
type { }
在實驗場打開 預期錯誤 E-VER-003

改法:把整份腳本改寫成 @meow 8.0。原本的 deckMode、effects.stage、effects.canvas 要改寫成 for keyboard.canvas 的程式(cart、state、on、view)。

E-HST-001 錯誤

unknown host

檔頭 for 後面的宿主不認得。訊息附「你是不是要寫」。

@meow 8.0 for widgets

view small {
  draw.clear(kit.deck)
}
在實驗場打開 預期錯誤 E-HST-001

改法:寫完整的宿主 id(deco.widget)或規格列出的別名(widget)。

E-LEX-001 錯誤

illegal character

非法字元。從聊天介面複製時最常見的是全形標點。彎引號 “ ” 會被默默修成 "(N-NRM-023),但全形括號、全形冒號、全形分號和 HTML 實體(<)不修。

@meow 8.0 for keyboard.canvas

let W = 320;

view {
  draw.clear(kit.deck)
}
在實驗場打開 預期錯誤 E-LEX-001

改法:換成 fix 行寫出的 ASCII 字元;這裡刪掉 ; 即可。

E-LEX-002 錯誤

string not terminated or longer than 24 characters

E-LEX-003 錯誤

unknown unit right after a number

E-LEX-004 錯誤

malformed colour literal

顏色字面量的格式錯誤:# 後面必須是 3、4、6 或 8 個十六進位數字。在程式層,# 永遠是顏色的開頭,所以把 # 當註解也會得到這一則。

@meow 8.0 for keyboard.canvas

view {
  draw.clear(#12345)
}
在實驗場打開 預期錯誤 E-LEX-004

改法:補成 #123456。程式層的註解用 //。

E-LIM-001 錯誤

source is over the size limit

E-LIM-002 錯誤

too many tokens

E-LIM-003 錯誤

nesting or expression too deep

E-LIM-004 錯誤

too many functions, params, sprites, literals, `draw.shade` targets, `sfx.note` voices or the like

E-LIM-005 錯誤

type nested too deep, a value over 1024 slots, or folding out of working memory

E-SYN-001 錯誤

expected a token

E-SYN-002 錯誤

blocks need `{ }`

區塊需要 { }。Python 風格的縮排區塊只給這一則。

@meow 8.0 for keyboard.canvas

view:
  draw.clear(kit.deck)
在實驗場打開 預期錯誤 E-SYN-002

改法:寫成 view { … }。縮排沒有意義。

E-SYN-003 錯誤

unbalanced braces or parentheses

E-SYN-004 錯誤

unknown top-level item

未知的頂層項目。訊息附「你是不是要寫」,候選包括舊的區塊名。

@meow 8.0

palete light {
  deck: #DCE8E6 -> #C8DAD7 @ 180deg
}

layout { }
type { }
在實驗場打開 預期錯誤 E-SYN-004

改法:寫成 palette light。事件寫 on 名字 { },畫面寫 view { }。

E-SYN-005 錯誤

a record literal in an `if` or `for` header needs parentheses

E-SYN-006 錯誤

an expression cannot stand alone as a statement

E-SYN-007 錯誤

comparison operators do not chain

比較運算子不能串接。

@meow 8.0 for keyboard.canvas

state {
  x: num = 160
}

view {
  draw.clear(kit.deck)
  if 0 < state.x < 320 {
    draw.circle(state.x, 80, 6, kit.accent)
  }
}
在實驗場打開 預期錯誤 E-SYN-007

改法:0 < state.x && state.x < 320。

W-SYN-008 警告

the script ends at this line; what follows is ignored

E-NAM-001 錯誤

unknown name

未知的名字。最常見的是打錯字,或讀狀態時漏了 state.。

@meow 8.0 for keyboard.canvas

save { best: num = 0 }

state {
  score: num = 0
}

on press(p) {
  state.score += 1
  if socre > save.best { save.best = state.score }
}

view {
  draw.clear(kit.deck)
}
在實驗場打開 預期錯誤 E-NAM-001

改法:換成 did you mean 給的名字,這裡是 state.score。

E-NAM-002 錯誤

unknown field or method

E-NAM-003 錯誤

redeclaration or shadowing

重複宣告,或遮蔽了一個看得見的名字。喵嗚不准遮蔽。

@meow 8.0 for keyboard.canvas

let W = 320

view {
  let W = 300
  draw.rect(0, 0, W, 10, kit.accent)
}
在實驗場打開 預期錯誤 E-NAM-003

改法:換一個名字,例如 let barW = 300。

E-NAM-004 錯誤

a state field needs the `state.` or `save.` prefix

讀寫狀態欄位時少了 state. 或 save. 前綴。

@meow 8.0 for keyboard.canvas

state {
  score: num = 0
}

on press(p) {
  score += 1
}

view {
  draw.number(state.score, 160, 20, {size: 18, color: kit.ink, align: "center"})
}
在實驗場打開 預期錯誤 E-NAM-004

改法:state.score += 1。

E-NAM-005 錯誤

a reserved word or namespace name is used as an identifier

用了保留字或內建命名空間的名字(time、draw、rand、kit、box、pad、L…)當識別字,或標準函式的名字。

@meow 8.0 for keyboard.canvas

let time = 0

view {
  draw.clear(kit.deck)
}
在實驗場打開 預期錯誤 E-NAM-005

改法:換一個名字,例如 let startAt = 0。

E-TYP-001 錯誤

type mismatch

E-TYP-002 錯誤

wrong number or type of arguments

E-TYP-003 錯誤

a condition must be `bool`

條件必須是 bool。喵嗚沒有「真值」。

@meow 8.0 for keyboard.canvas

state {
  lives: num = 3
}

on press(p) {
  if state.lives { state.lives -= 1 }
}

view {
  draw.number(state.lives, 160, 20, {size: 18, color: kit.ink, align: "center"})
}
在實驗場打開 預期錯誤 E-TYP-003

改法:if state.lives > 0。

E-TYP-004 錯誤

no implicit conversion

E-TYP-005 錯誤

not every path returns, or the return type does not match

E-TYP-006 錯誤

enum literal is not in the set

列舉字面量不在集合內。訊息列出全部合法值。貓的姿勢、圖示、音色都是列舉。

@meow 8.0 for keyboard.canvas

view {
  draw.clear(kit.deck)
  draw.cat("mimimo", "jump", 160, 80, 24)
}
在實驗場打開 預期錯誤 E-TYP-006

改法:換成表上有的值,例如 "puff"。全部的值見列舉與常數。

E-TYP-007 錯誤

`str` cannot be concatenated, indexed or made from a number

str 不能串接、索引或從數字轉換。

@meow 8.0 for deco.widget

view small {
  draw.text("電量 " + battery.level, 12, 24, {size: 14, color: kit.ink})
}
在實驗場打開 預期錯誤 E-TYP-007

改法:用 fmt 印數字,用片語表 L.* 顯示詞語,例如 draw.text(L.battery, …) 加 draw.number(round(battery.level * 100), …)。

E-TYP-008 錯誤

`list` may only appear in `state`

E-TYP-009 錯誤

colours cannot be divided

顏色不能相除。程式層沒有 #亮 / #暗 字面量。

@meow 8.0 for keyboard.canvas

view {
  draw.clear(#F6F1E7 / #1B1F24)
}
在實驗場打開 預期錯誤 E-TYP-009

改法:scheme(#F6F1E7, #1B1F24),或直接用 kit.deck。

E-TYP-010 錯誤

array literal length does not match the declaration

E-TYP-011 錯誤

unknown field in an options record

E-MUT-001 錯誤

assignment to a `let`

E-MUT-002 錯誤

modifying an immutable copy

修改了不可變的複本。let s = state.stars[0] 得到的是複本,不是參考。

@meow 8.0 for keyboard.canvas

struct Star { x: num, y: num }

state {
  stars: list<Star, 8>
}

on tick {
  let s = state.stars[0]
  s.x -= 1
}

view {
  draw.clear(kit.deck)
}
在實驗場打開 預期錯誤 E-MUT-002

改法:state.stars[0].x -= 1,或用 for s in state.stars { s.x -= 1 }。

E-MUT-003 錯誤

write inside `view` or a pure function

E-MUT-004 錯誤

`push`, `removeAt` or `clear` on the list being iterated

正在 for 迭代一個清單時,對同一個清單 push、removeAt 或 clear。

@meow 8.0 for keyboard.canvas

struct Star { x: num, y: num }

state {
  stars: list<Star, 8>
}

on tick {
  for s in state.stars {
    if s.x > 300 { state.stars.push({x: 0, y: s.y}) }
  }
}

view {
  draw.clear(kit.deck)
}
在實驗場打開 預期錯誤 E-MUT-004

改法:把 push 移到迴圈之後。要刪掉目前的元素用 state.stars.remove(s),它會等迴圈結束才生效。

E-EFF-001 錯誤

`view` writes `state` or `save`

view 寫了 state 或 save。view 只能讀。

@meow 8.0 for keyboard.canvas

state {
  frames: num = 0
}

view {
  state.frames += 1
  draw.number(state.frames, 160, 20, {size: 18, color: kit.ink, align: "center"})
}
在實驗場打開 預期錯誤 E-EFF-001

改法:把計數移到 on tick。

E-EFF-002 錯誤

a function both draws and acts

E-EFF-003 錯誤

`draw.*` called inside `on`

on 處理器裡呼叫了 draw.*。

@meow 8.0 for keyboard.canvas

on press(p) {
  draw.circle(p.x, p.y, 8, kit.accent)
}

view {
  draw.clear(kit.deck)
}
在實驗場打開 預期錯誤 E-EFF-003

改法:在 on press 裡把位置存進 state,在 view 裡畫。

E-EFF-004 錯誤

a top-level `let` depends on a name it may not use, or a `params` default is not a literal

頂層 let 依賴了不允許的名字(time、rand、kit.*、device.*、box.*、資料命名空間),或 params 的預設值不是字面量。頂層 let 只算一次,而這些值在執行中會變。

@meow 8.0 for keyboard.canvas

let glow = alpha(kit.accent, 0.4)

view {
  draw.clear(kit.deck)
  draw.circle(160, 80, 30, glow)
}
在實驗場打開 預期錯誤 E-EFF-004

改法:寫成函式,fn glow() -> color { return alpha(kit.accent, 0.4) },在 view 裡呼叫 glow()。

E-EFF-005 錯誤

`rand.*` used outside `on`

rand.* 用在 on 以外的地方。

@meow 8.0 for keyboard.canvas

view {
  draw.clear(kit.deck)
  draw.circle(rand.range(0, 320), 80, 4, kit.accent)
}
在實驗場打開 預期錯誤 E-EFF-005

改法:在 on 裡產生亂數並存進 state;view 裡要「看起來隨機」就用 hash(i)。

E-EFF-006 錯誤

`draw.translate`, `rotate`, `scale`, `alpha` or `clip` used outside `draw.push()`

draw.translate、rotate、scale、alpha、clip 用在 draw.push() 之外。

@meow 8.0 for keyboard.canvas

view {
  draw.clear(kit.deck)
  draw.rotate(15deg)
  draw.rect(140, 60, 40, 40, kit.accent)
}
在實驗場打開 預期錯誤 E-EFF-006

改法:包在 draw.push() 和 draw.pop() 之間。

E-EFF-007 錯誤

`draw.push` and `draw.pop` do not pair up

E-REC-001 錯誤

recursion

遞迴。訊息列出迴圈的路徑。

@meow 8.0 for keyboard.canvas

fn fib(n) -> num {
  return n < 2 ? n : fib(n - 1) + fib(n - 2)
}

view {
  draw.number(fib(8), 160, 20, {size: 18, color: kit.ink, align: "center"})
}
在實驗場打開 預期錯誤 E-REC-001

改法:改寫成有上界的 for 迴圈。

E-BND-001 錯誤

loop bound is not statically bounded

迴圈的上界不是靜態有界。

@meow 8.0 for keyboard.canvas

state {
  count: num = 3
}

view {
  for i in 0..state.count {
    draw.circle(20 + i * 12, 80, 4, kit.accent)
  }
}
在實驗場打開 預期錯誤 E-BND-001

改法:把上界包起來,0..min(state.count, 16)。

E-BND-002 錯誤

a single loop runs more than 4096 times

E-TIR-001 錯誤

the program's tier is above the host's

E-TIR-002 錯誤

this host has no such event or view name

E-TIR-003 錯誤

`while` or another reserved construct is not available in 8.0

while,或其他保留的構造(loop、match、import),8.0 不能用。

@meow 8.0 for keyboard.canvas

state {
  y: num = 0
}

on tick {
  while state.y < 100 { state.y += 1 }
}

view {
  draw.clear(kit.deck)
}
在實驗場打開 預期錯誤 E-TIR-003

改法:for i in 0..N { if !條件 { break } … };這裡其實寫成 state.y = min(state.y + 1, 100) 就好。

E-TIR-004 錯誤

a view the host requires is missing

E-CAP-001 錯誤

a capability the host does not grant is used

用了宿主不授予的能力。訊息列出這個宿主有的能力,以及最接近的替代。

@meow 8.0 for keyboard.canvas

view {
  draw.clear(kit.deck)
  draw.number(round(battery.level * 100), 160, 20, {size: 18, color: kit.ink, align: "center"})
}
在實驗場打開 預期錯誤 E-CAP-001

改法:鍵盤畫布沒有 battery;電量只有 deco.* 宿主有。各宿主的能力見宿主頁。

W-CAP-002 警告

`needs` lists a capability that is not used

E-CAP-003 錯誤

this host has no free text; use a number template or `L.*`

這個宿主沒有自由文字。鍵盤主題、鍵盤畫布、桌布、充電動畫、桌寵都沒有。

@meow 8.0 for keyboard.canvas

view {
  draw.clear(kit.deck)
  draw.text("tap to start", 160, 80, {size: 13, color: kit.ink, align: "center"})
}
在實驗場打開 預期錯誤 E-CAP-003

改法:用片語表,draw.text(L.tapToStart, …);數字用 draw.number 或不含字母的 fmt 模板。

E-CRT-001 錯誤

unknown `cart` key or illegal value

cart 有未知的鍵,或值不在值域內。訊息附「你是不是要寫」和這個宿主認得的鍵。

@meow 8.0 for keyboard.canvas

cart {
  pads: three
}

view {
  draw.clear(kit.deck)
}
在實驗場打開 預期錯誤 E-CRT-001

改法:pads 只能是 none、one、two、keys,可以接樣式 outline 或 hidden。

E-KIT-001 錯誤

unknown kit token

W-KIT-002 警告

a `deco.*` component writes a colour, radius or stroke literal outside `kit { }`

E-SPR-001 錯誤

sprite size or row width is wrong

E-SPR-002 錯誤

a sprite palette entry must be a `kit.*` colour

E-SLT-001 錯誤

a slot where no slot is accepted

E-SLT-002 錯誤

a slot depends on a runtime value

E-SLT-003 錯誤

the slot's type does not fit the position

E-SLT-004 錯誤

the slot lacks the unit suffix this position needs

插槽少了這個位置需要的單位。位置、比例這類位置的插槽必須寫 % 或 x,單位寫在大括號外面。

@meow 8.0 for keyboard.theme

params {
  peaks: num = 3 in 2..5 step 1
}

palette light {
  deck: #DCE8E6 -> #C8DAD7 @ 180deg
}

motifs {
  for i in 0..peaks {
    mountainRange at ${(i + 0.5) / peaks * 100} 82% scale 0.9x rot 0deg #3E6B68 @ 24%
  }
}

layout { }
type { }
在實驗場打開 預期錯誤 E-SLT-004

改法:at ${(i + 0.5) / peaks * 100}% 82%。

E-GEN-001 錯誤

a generator outside `layers`, `motifs` or `rigs`

E-GEN-002 錯誤

expansion exceeds the block's count limit

E-BUD-001 錯誤

static fuel bound of a `view`, slot or shader is over budget

W-BUD-002 警告

static fuel bound of an `on` handler is over budget

E-BUD-003 錯誤

state slots over budget

E-BUD-004 錯誤

static draw-op bound over budget, or baked output over the `views/` size limit

E-BUD-005 錯誤

bytecode or constant pool over the limit

E-SHD-001 錯誤

`use` names a function that does not exist or does not return `vec4` or `color`

E-SHD-002 錯誤

the function cannot run on the GPU

E-SHD-003 錯誤

unknown shader input name

E-SHD-004 錯誤

more than 64 iterations per pixel

E-SHD-005 錯誤

`LEGACY` output exceeds the old limits

E-SHD-006 錯誤

this emission target does not support the input or function

E-SHD-007 錯誤

static fuel bound per pixel is over 2000

E-SHD-008 錯誤

the C-style shader body under an 8.x header cannot be parsed

E-SHD-009 錯誤

a legacy shader `for` bound is not an integer literal of at most 64

E-SHD-010 錯誤

the shader exceeds the flicker limit when sampled at import

W-SHD-001 警告

the legacy shader body cannot be parsed; pasted through as text

W-SHD-002 警告

the CPU fallback dropped to a lower resolution

E-TNT-001 錯誤

a GPU-only input flows into a CPU call path

E-SAF-001 錯誤

a literal is blocked by the safety gate

E-SAF-002 錯誤

an identifier is on the brand or game name list

E-SAF-003 錯誤

text of a baked view or poster, joined in reading order, is blocked, or has 7 or more digits in a row

E-SAF-004 錯誤

a QR finder pattern was detected in a baked view or poster

E-SAF-005 錯誤

a small dot imitating a system indicator in a compact or minimal presentation

W-SAF-006 警告

(Studio) the number next to a `bolt` icon is not computed from `battery.level`

E-IMP-001 錯誤

invalid theme parameter overrides

E-IMP-002 錯誤

theme rejected by the legacy parser or product validator

W-IMP-001 警告

multiple script candidates were found

W-IMP-002 警告

the legacy theme normalizer adjusted supplied values

W-IMP-003 警告

the product validator reported a theme warning

W-CON-001 警告

some samples in the parameter range fail the contrast rules

E-PKG-001 錯誤

share code damaged or checksum mismatch

E-PKG-002 錯誤

share code over the length limit

N-NRM-001 正規化紀錄

took the block with the `@meow` line out of a fence or surrounding chat

N-NRM-002 正規化紀錄

header version written in full

N-NRM-003 正規化紀錄

host alias replaced by the full host id

N-NRM-004 正規化紀錄

top-level `const` or `var` became `let`

N-NRM-005 正規化紀錄

`function` or `def` became `fn`

N-NRM-006 正規化紀錄

`===`, `!==`, `and`, `or`, `not` became `==`, `!=`, `&&`, `||`, `!`

N-NRM-007 正規化紀錄

`float2/3/4(...)` became `vec2/3/4(...)`

N-NRM-008 正規化紀錄

`Math.` prefix removed, `Math.PI` became `3.14159`

N-NRM-009 正規化紀錄

`i++`, `i--`, `++i` became `i += 1`, `i -= 1`

N-NRM-010 正規化紀錄

C-style `for` became a range `for`

N-NRM-011 正規化紀錄

`40%` not followed by an operand became `0.4`

N-NRM-012 正規化紀錄

two statements on one line were split

N-NRM-013 正規化紀錄

`elif` or `elseif` became `else if`

N-NRM-014 正規化紀錄

`if` in expression position became `? :`

N-NRM-015 正規化紀錄

trailing comma or extra `;` removed

N-NRM-016 正規化紀錄

type annotation `float`, `int`, `number`, `boolean` or `string` renamed

N-NRM-017 正規化紀錄

`enum("a", "b")` as a type became `"a" | "b"`

N-NRM-018 正規化紀錄

`on tick()` became `on tick`

N-NRM-019 正規化紀錄

top-level `needs` moved into `cart { }`

N-NRM-020 正規化紀錄

`needs` was missing a capability; added

N-NRM-021 正規化紀錄

slot unit written inside the braces; not repaired (reported as E-SLT-004)

N-NRM-022 正規化紀錄

`needs: haptics` became `haptic`

N-NRM-023 正規化紀錄

curly quotes around a string became `"`

N-NRM-024 正規化紀錄

a `params` default off its step grid or outside its range was moved onto it (ruling R-9)

W-A11Y-001 警告

(Studio) the `view` never calls `a11y`

W-A11Y-002 警告

(Studio) a second `a11y` in one `view` run was ignored

W-RUN-001 警告

(Studio) division by zero

W-RUN-002 警告

(Studio) index out of bounds was clamped or ignored

W-RUN-003 警告

(Studio) the result of `push` was dropped and the list had been full

R-FUEL 執行期

a handler ran out of fuel and was rolled back

R-DRAW 執行期

the draw list is full; further ops were dropped

R-AREA 執行期

the area budget is used up; further ops were dropped

核對日期 2026-12-03 · 依據 MeowLang/docs/LANGUAGE.md#12、MeowLang/docs/LANGUAGE.md#3.4、MeowLang/docs/LANGUAGE.md#13、MeowLang/docs/LANGUAGE.md#2.4、MeowLang/docs/LANGUAGE.md#5、MeowLang/docs/LANGUAGE.md#6、MeowLang/docs/HOSTS.md#2、MeowLang/docs/HOSTS.md#3、MeowLang/docs/CANVAS.md#6.2、MeowLang/docs/CANVAS.md#8、MeowLang/docs/AI_PROMPTS.md#8.3、.worktrees/core-mew/crates/meowpuut-script/DESIGN.md#6