Hitting the wall; what am I doing wrong?

Abierto
#288 6 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
20/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
cpp
Área
compilers

Línea de trabajo

Comienza con parser_fwd.hpp y libs/parser.cpp alrededor de la línea 187, y después reproduce la compilación de MSVC del commit 2ef0a54 para observar el bloqueo de la compilación. Investiga si la compilación separada de la gramática, los atributos shared_ptr de AST o el número de reglas explican el comportamiento; se considerará completado cuando haya una explicación confirmada o una guía documentada.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Hitting the Wall when Compiling the Grammar

I've been developing a parser for a fractal renderer formula file. Things were progressing nicely as I started parsing larger and larger elements of the format until I seemingly hit a wall. As of commit 2ef0a54 on the formula-compiler repository, I can't seem to add any more rules or the compilation just hangs on msvc. Note that it doesn't error, it just seems to get stuck compiling. I don't see any high activity bars on my disk or my CPU, so I'm not sure what the compiler is doing. But it ran for many minutes and didn't finish compiling parser.cpp.

Separate Compilation?

The header parser_fwd.hpp made me think that I might be able to break my parser into multiple source files and reduce the pressure on template mechanisms. I had noticed that the compile time for the parser was increasing as I added more details into my parser, but I considered this normal, especially as I was building Debug. However, I tried my best to separate out a simple rule into a separate translation unit and was unsuccessful. GitHub Copilot gave it a try, but only flailed around for 30 minutes before I put it out of it's misery.

Is there a mechanism for separate compilation of parts of a grammar? None of the examples demonstrate separate compilation.

My AST is a Hierarchy of Node shared_ptrs

The documentation recommends using the synthesized attributes for rules, but there doesn't seem to be automatic attribute propagation to shared_ptrs as the attributes. Therefore I need semantic action builder functions to create the attribute in my AST from the attribute synthesized by the framework. Is this putting additional template pressure on the compiler?

How Does the Number of Rules Impact Compilation?

I can create local parsers, e.g. const auto alpha = char_('a', 'z') | char_('A', 'Z'); without rules and use them to build productions that generate AST nodes. I also have a bunch of rules (see parser.cpp line 187). Should I be preferring fewer rules to reduce template pressure on the compiler or are they the same cost as the local parsers?

Lenguaje dominante
C++
Estrellas
182
Forks
28
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de boostorg/parser

Todos los issues de boostorg/parser

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.