Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLSL preprocessor: support for #define, #ifdef etc. #4

Open
kfish opened this issue May 20, 2014 · 3 comments
Open

GLSL preprocessor: support for #define, #ifdef etc. #4

kfish opened this issue May 20, 2014 · 3 comments

Comments

@kfish
Copy link

kfish commented May 20, 2014

The preprocessor is part of the GLSL spec, section 3.4 of https://www.khronos.org/registry/gles/specs/2.0/GLSL_ES_Specification_1.0.17.pdf

Is it even possible to handle #define and #ifdef properly in language-glsl?

@noteed
Copy link
Owner

noteed commented May 20, 2014

Being a preprocessor, I thought it could (or even should) be implemented separately from the main parser (provided by language-glsl). But it seems it would be better to include it in language-glsl: for instance error messages have to take the #line directive into account.

I don't think it should be a problem for language-glsl to parse the preprocessor directives and expose them as top-level data types in the resulting parse tree. Or maybe even interpret them and push the result (e.g. optimization hint) into the existing (but then enriched) data types.

Conceptually mixing the line-oriented nature of the preprocessor with the rest of the language is a bit weird but I don't think it would prevent it to be part of the parser.

@nphollon
Copy link

nphollon commented Sep 2, 2015

@noteed @kfish Did anybody get a chance to look into this more? I was blocked by this issue recently, but I am not comfortable enough with Haskell to fix it

@noteed
Copy link
Owner

noteed commented Sep 3, 2015

@nphollon I don't think I will have time to work on this but would happily accept a patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants