Created
October 23, 2025 19:49
-
-
Save LeeMetaX/8eef3e01a0ff5b15755037194b0d7c14 to your computer and use it in GitHub Desktop.
Language ROS for Encodings for APL, BASIC, English
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <# | |
| .SYNOPSIS | |
| Build an unabridged UTF-8 symbol index for APL and BASIC. | |
| Writes /mnt/data/symbol_index.json | |
| #> | |
| $ErrorActionPreference = 'Stop' | |
| $dataset = @() | |
| # ---------- BASIC ---------- | |
| $basic = @( | |
| 'AND','OR','NOT','IF','THEN','ELSE','FOR','TO','STEP','NEXT', | |
| 'GOTO','GOSUB','RETURN','PRINT','INPUT','DIM','DEF FN','END','REM', | |
| 'DATA','READ','RESTORE','CHR$','ASC','LEN','MID$','LEFT$','RIGHT$', | |
| 'RND','SIN','COS','TAN','LOG','EXP','PEEK','POKE','OPEN','CLOSE', | |
| 'INPUT#','PRINT#','ON','ERROR','RESUME','+','-','*','/','^','=','<', | |
| '>','<=','>=','<>' | |
| ) | |
| foreach ($sym in $basic) { | |
| $dataset += [ordered]@{ | |
| lang='BASIC' | |
| symbol=$sym | |
| name="BASIC keyword or operator" | |
| ascii_equiv=$sym | |
| unicode=[string]::Join(' ',($sym.ToCharArray() | ForEach-Object {"U+{0:X4}" -f [int][char]$_})) | |
| invariant_id=":BASIC_$($sym.Replace(' ','_').Replace('$','S'))" | |
| variant_byte="0x{0:X2}" -f ([int]([byte][char]$sym[0])) | |
| state=":1" | |
| } | |
| } | |
| # ---------- APL ---------- | |
| # Use the Unicode block 2336–237A for primary glyphs. | |
| $aplSymbols = @( | |
| '+','-','×','÷','⋆','⍟','⌹','○','<','≤','=','≥','>','≠','∨','∧', | |
| '⍲','⍱','∊','⊂','⊃','↑','↓','⍴','⍳','⍸','⌷','⍋','⍒','⍉','⍪','⍎', | |
| '⍕','⎕','⍞','⍠','⍣','⍤','⍥','⍨','⍫','⍬','⍺','⍵','∇','¯','⍹' | |
| ) | |
| foreach ($sym in $aplSymbols) { | |
| $dataset += [ordered]@{ | |
| lang='APL' | |
| symbol=$sym | |
| name='APL glyph' | |
| ascii_equiv='N/A' | |
| unicode="U+{0:X4}" -f [int][char]$sym | |
| invariant_id=":APL_{0:X4}" -f [int][char]$sym | |
| variant_byte="0x{0:X2}" -f ([int][byte][char]$sym[0]) | |
| state=":1" | |
| } | |
| } | |
| # ---------- Write file ---------- | |
| $path = "/mnt/data/symbol_index.json" | |
| $json = $dataset | ConvertTo-Json -Depth 4 -Compress | |
| [IO.File]::WriteAllText($path,$json,[Text.Encoding]::UTF8) | |
| Write-Host "Dataset written to $path (`$($dataset.Count) entries)." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment