Proposal: Nanopass compiler support
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Necesita aclaración
- Estado de actividad
- Tranquilo
- Área
- compilers
Línea de trabajo
Comienza con la propuesta y su disertación de Nanopass enlazada, así como con la documentación de Racket; el issue no menciona archivos, pruebas ni puntos de entrada de Langkit. Para darlo por terminado, sería necesario acordar un diseño para los lenguajes intermedios, las pasadas, las transformaciones, la validación, las pipelines y los stubs de Ada generados antes de poder delimitar el alcance de la implementación.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Ada
- Estrellas
- 94
- Forks
- 34
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de AdaCore/langkit
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 45/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
-
Struggles building Langkit with AlireQuizá libre de nuevo @pmderodat la tomó hace 859 días y no hay ningún pull request abierto. Abierto
-
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
Todos los issues de AdaCore/langkit
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
documentation self-host
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
JakeChampion/lang#10663 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día