Proposal: Nanopass compiler support
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Tranquilla
- Ambito
- compilers
Direzione di ricerca
Inizia dalla proposta e dalla dissertazione Nanopass collegata, nonché dalla documentazione di Racket; l’issue non indica alcun file, test o punto di ingresso di Langkit. Per considerarlo completato, sarebbe necessario concordare una progettazione per i linguaggi intermedi, i pass, le trasformazioni, la validazione, le pipeline e gli stub Ada generati prima di poter definire l’ambito dell’implementazione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
This is a proposal for adding support for building Nanopass compilers to Langkit (most likely in a fork rather than something that will ever be upstreamed). I'm looking to get some feedback on this from other Langkit users to help refine this idea before I start implementing this. For some background on Nanopass compilers, refer to the following:
In short, from the second document:
The nanopass framework provides a tool for writing compilers composed of several simple passes that operate over well-defined intermediate languages. The goal of this organization is both to simplify the understanding of each pass, because it is responsible for a single task, and to simplify the addition of new passes anywhere in the compiler.
Currently it is entirely possible to write a Nanopass compiler using Langkit by manually writing a series of transformations, however this involves a lot of boilerplate, especially if one wants to formally define and check intermediate languages. I propose the addition of a set of new Langkit constructs to easily and formally define intermediate languages, pipelines, and transformers. I imagine this would look something like the following:
language parsed_foolang from grammar foolang_grammar;
language flat_foolang extends parsed_foolang {
remove BlockStatement;
}
pass flatten_blocks : parsed_foolang -> flat_foolang
with Libfoolang.Nanopass.Passes.Flatten_Blocks;
where Libfoolang.Nanopass.Passes.Flatten_Blocks is an Ada package with a Transform functions which takes some kind of rewriting handle. Langkit would generate the stub for this package.
In addition to remove, which makes a node invalid to have in a language, we would also have add to make a node valid and replace to change the shape of a node. I'm not sure exactly what this would look like yet.
Langkit would also be able to generate a pipeline function which calls a series of passes and checks that the outputs are valid between then.
That's about all I have on this idea for now, I plan to start prototyping it after I finish some other projects. Any ideas on how to design this are welcome.
- Lingua principale
- Ada
- Stelle
- 94
- Fork
- 34
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri 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 AdaCore/langkit
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 45/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
Tutte le issue di AdaCore/langkit
Issue simili
-
`String.Parser.chompUntilEndOr` leaves the column one short when it runs to the end past a newline Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
enhancement PyCDE
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
llvm:support
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
llvm/llvm-project#226296 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
abseil/abseil-cpp#2176 ·