Idiomatically determine all the characters that can be used for symbols.
The word symbols is meant things like names of variables, procedures (i.e., named fragments of programs, functions, subroutines, routines), statement labels, events or conditions, and in general, anything a computer programmer can choose to name, but not being restricted to this list. Identifiers might be another name for symbols.

The method should find the characters regardless of the hardware architecture that is being used (ASCII, EBCDIC, or other).

Task requirements
Display the set of all the characters that can be used for symbols which can be used (allowed) by the computer program.
You may want to mention what hardware architecture is being used, and if applicable, the operating system.

Note that most languages have additional restrictions on what characters can't be used for the first character of a variable or statement label, for instance. These type of restrictions needn't be addressed here (but can be mentioned).

See also
 Idiomatically determine all the lowercase and uppercase letters.


without js -- file i/o, system_exec, \t and \r chars
function run(string ident)
    integer fn = open("test.exw","w")
    printf(fn,"object %s",ident)
    close(fn)
    return system_exec("p -batch test.exw")
end function
 
function check(integer lo, hi)
    string ok1 = "", ok2 = ""
    integer ng1 = 0, ng2 = 0
    for ch=lo to hi do
        printf(1,"%d/%d...\r",{ch,hi})
        if find(ch,"\t\r\n \0\x1A;") then
            ng1 += 1
            ng2 += 1
        else
            string c = sprintf("%c",ch)
            if run(c)==0 then ok1 &= c else ng1 += 1 end if
            if run("_"&c)==0 then ok2 &= c else ng2 += 1 end if
        end if
    end for
    return {{ng1,length(ok1),ok1},
            {ng2,length(ok2),ok2}}
end function
 
sequence r = check(0,127)
printf(1,"ansi characters:\n===============\n")
printf(1,"1st character: %d bad, %d OK %s\n",r[1])
printf(1,"2nd..nth char: %d bad, %d OK %s\n\n",r[2])
r = check(128,255)
integer ok8 = 0, ng8 = 0
for i=#80 to #10FFFF do
    if i<#D800 or i>#DFFF then
        printf(1,"#%x/#10FFFF...\r",i)
        string utf8 = utf32_to_utf8({i})
        bool ok = true
        if not find(utf8[1],r[1][3]) then
            ok = false
        else
            for j=2 to length(utf8) do
                if not find(utf8[j],r[2][3]) then
                    ok = false
                    exit
                end if
            end for
        end if
        if ok then
            ok8 += 1
        else
            ng8 += 1
        end if
    end if
end for
printf(1,"utf8 characters:   \n===============\n")
printf(1,"bad:%,d, good:%,d\n",{ng8,ok8})
