Cx Dev Log — 2026-06-28

Iniciado por joomlamz, Hoje at 02:25

Respostas: 0   |   Visualizações: 4

Tópico anterior - Tópico seguinte

0 Membros e 1 Visitante estão a ver este tópico.

Cx Dev Log — 2026-06-28



Tópico: Cx Dev Log — 2026-06-28
Categoria: Tutoriais | Programação & Tecnologia
Idioma Principal: Português (Conteúdo de Tecnologia)

Descrição do Conteúdo / Informações:
-------------------------------------------------------------------------
Labeled break/continue is now live across the entire Cx language stack. From the lexer to the JIT, two commits streamlined the implementation into a complete vertical slice. No parts left out, no corners cut—everything just works.



The lexer seam


If you're handling character literals and labels in the same codebase, you'll know what a pain this can be. We opted for a Rust-like syntax: 'ident for labels, with no closing quote. The label regex sits right after LiteralChar in the logos enum. Thanks to longest-match, 'x' becomes a char literal, while 'outer is parsed as a label. Escape sequences? They can't match labels because they have a backslash, making 'x' always look cleaner in code. A test fixture (t_char_literal_guard) ensures this order and regex integrity hold. Change the lexer rules, and it'll catch any mistakes immediately.



Two-commit split


We didn't cram this into a single mega-commit. No, we split it into two. Commit f94c6a5 laid down the frontend groundwork—adding the Label token, allowing loops and breaks to carry optional labels, and rejecting any misuse with semantic checks. The interpreter and JIT, however, initially took a back seat, guarding themselves against mislabeled jumps.

Then came commit 0f56f1e, which wiped out these guards and enabled real execution on backends. Now all parses and semantic checks play nicely without rogue labeled breaks sneaking into the wrong loops.



Interpreter changes


The interpreter now handles BreakSignal and ContinueSignal carrying labels. Loops catch these signals when the label is either absent (defaulting to the innermost loop) or matches their own. The difference from before? Zero unlabelled break/continue behavior change while facilitating outward jumps.



JIT changes


The JIT saw more extensive adjustments, gaining a label field within LoopContext. Push and pop that context on a stack, trace it through lowering calls, and you've got labeled jumps pinpointed. The unlabeled jumps? They get the same treatment as before by taking the top of the stack. Existing codegen remains untouched, minus this stack expansion for labeled functionality.



Test fixtures


To solidify all this, we introduced four new test fixtures. Semantic rejections? Covered. Breaking and continuing to outer loops? Nailed. This test suite now boasts stability: 292 pass, 0 fail.



Other changes


We've also logged a packed-i128 representation and updated the ? operator details on the site branch (07bef03).



What's next


Labeled breaks dug into the core of semantic.rs and lower.rs, setting the stage for optimizing when block lowering. Projects like DotAccess in compound forms and dynamic strings are still in queue, waiting for their time in the spotlight. But, the submain branch grows restless, 26 commits ahead and aging since its last merge—no regressions, just merge delays.

Follow the Cx language project:

• Website: cx-lang.com

• GitHub: github.com/COMMENTERTHE9/Cx_lang

Dev.to: dev.to/commenterthe9

• Bluesky: thecomment.bsky.social

• Twitter/X: @commenterthe9

Originally published at https://cx-lang.com/blog/2026-06-28


Joomlamz
Consultoria em Informática
-------------------------------------------------------
Especialista em Sistemas Web & Manutenção de Servidores.
A desenvolver o novo AplPortal com suporte a PHP 8.
Precisa de ajuda profissional? Contacte-me.

Tags: