spec icon indicating copy to clipboard operation
spec copied to clipboard

relax the var to allow utf8 encoding in the wat syntax

Open bobzhang opened this issue 2 years ago • 2 comments

According to the reference interpreter

let symbol =
  ['+''-''*''/''\\''^''~''=''<''>''!''?''@''#''$''%''&''|'':''`''.''\'']
let letter = ['a'-'z''A'-'Z']
let idchar = letter | digit | '_' | symbol
let name = idchar+
let id = '$' name

  | id as s { VAR s }

Currently I can only write ascii letters in the wat syntax, (local $var). It is a bit awkward to encode other utf8 letters in the wat syntax, so people can write (local $你好).

It is a bit worse in the current situation, since no escaping syntax supported so we have to do some magic encoding here

bobzhang avatar Mar 04 '23 04:03 bobzhang

seems to be relevant to #617, the title is a bit misleading, it is not strange symbols though

bobzhang avatar Mar 04 '23 05:03 bobzhang

Yes, this is as spec'ed in the standard, and it is rather intentional that program text (outside strings and comments) is limited to plain ASCII. Unicode identifiers are a can of worms, as explained in the other issue.

The ability to annotate richer print names is part of the annotations proposal.

rossberg avatar Mar 04 '23 10:03 rossberg