Non-ASCII characters in symbol names
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 75/100
Direzione di ricerca
Start from pyk/src/pyk/konvert/_utils.py to fix munge to encode non-ASCII characters as 4-hex-digit UTF-16 chunks. Then update the decoders: KoreToK.mapCode in k-frontend/src/main/scala/org/kframework/parser/kore/parser/KoreToK.scala, decodeKoreString in k-frontend/src/main/java/org/kframework/utils/StringUtil.java, and decode_kore in llvm-backend/lib/ast/AST.cpp to recognize [0-9a-f]{4} chunks and convert them back to characters. Run the relevant test suites to verify the round-trip.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
ModuleToKORE encodes each non-ASCII UTF-16 code unit as a 4-hex-digit chunk inside the '...' block, so λ → Lbl'03bb' and 𐔷 (U+10537, a surrogate pair) → Lbl'd801dd37':
Every chunk is exactly 4 characters (the overrides below make sure of that) and lowercase hex never collides with a mnemonic, so the encoding is unambiguous:
Both backends accept these names, since ' is a legal identifier character:
- https://github.com/runtimeverification/haskell-backend/blob/ec0486c03af923071544fd61e35e9426507aac33/kore/src/Kore/Parser/Lexer.x#L57
- https://github.com/runtimeverification/llvm-backend/blob/7ca095a55430e587a444c4dbdbc96ab3ee9d4933/lib/parser/KOREScanner.l#L26
Bug 1: pyk munge does not encode non-ASCII
Characters outside MUNGE_TABLE are copied verbatim, so munge('λ') == 'λ', which is not a valid KORE identifier and differs from what kompile emits:
Bug 2: no decoder converts hex chunks back to characters
Reachable today:
KoreToK.mapCode (used for symbol names) parses the hex and then discards it, returning the text \u03bb instead of the character:
pyk unmunge raises ValueError('Unknown encoding "03bb"'):
Latent, because these two are only applied to variable names and #KVariable restricts those to ASCII [A-Za-z0-9'_] plus a !/?/@ prefix (the @ is split off before encoding):
StringUtil.decodeKoreString looks the slice up in the default map and appends the string "null" on a miss:
llvm-backend decode_kore does codes[code] on a missing key and emits a NUL byte per chunk:
The haskell-backend never decodes names and is unaffected.
Side issues
decodeKoreString uses the default table, so it would also miss the KORE overrides And-, -LT-, -GT-, -AT-, Xor- if ever applied to a symbol name:
llvm-backend maps SCln to 'l' instead of ';':
Expected
mungeproduces the same encoding asModuleToKORE(per UTF-16 code unit,%04x).- Decoders recognise a
[0-9a-f]{4}chunk and convert it back to a code unit, recombining surrogate pairs where the host string type is not UTF-16, or fail loudly instead of producingnull/NUL.
- Lingua principale
- Python
- Stelle
- 596
- Fork
- 164
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di runtimeverification/k
-
Introduce composable symbolic execution interface in pyxForse di nuovo libera @Stevengre l’ha presa 120 giorni fa e non c’è nessuna pull request aperta. Aperta
runtimeverification/k#4939 · 1 assegnatario ·
-
Concolic ExplorerAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 32/100
runtimeverification/k#4937 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
runtimeverification/k#4936 ·
-
Accelerating all-path reachability proofs with one-path reachability proofsForse di nuovo libera @Stevengre l’ha presa 125 giorni fa e non c’è nessuna pull request aperta. Apertatype:epic
runtimeverification/k#4934 · 4 commenti · 1 assegnatario ·
-
Support progressive depth halving as a generic policy in `Prover.advance_proof`Forse già presa @Stevengre l’ha presa 145 giorni fa. Aperta
runtimeverification/k#4924 · 1 assegnatario ·
Tutte le issue di runtimeverification/k
Issue simili
-
infrastructure
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
khuisman/mcp-gee-sweet#1152 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
backroom bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ditto-assistant/ditto-subnet#3069 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
open-webui/open-webui#32901 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
0.3.3 bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno