Skip to content

Commit

Permalink
Add more info about the project in README
Browse files Browse the repository at this point in the history
  • Loading branch information
wpmed92 committed Aug 4, 2024
1 parent 6420292 commit f6f0dc0
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# ShaderPulse

ShaderPulse is an experimental GLSL to SPIR-V dialect frontend.
ShaderPulse is an experimental GLSL to SPIR-V dialect frontend. It consists of a lexer, a parser, a semantic analyzer and a code generator. The different parts of the compiler are at different stages of completion. The work is based on the [GLSL 4.60.8 specifications](https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf).

## Lexer

The lexer takes in the source code in text format and outputs valid GLSL tokens. It supports all the keyword, punctuator, identifier and literal tokens defined in the specs. There are tests for this component in `test/Lexer/LexerTest`.

## Parser

Takes in the token stream generated by the `Lexer` and outputs an Abstract Syntax Tree. It is top-down recursive descent parser. It supports variable declarations, assignments, function declarations, function calls, unary and binary expressions, constructor expressions, member access (incomplete), structs (incomplete), and arrays (incomplete). There is a lot of work to do on this front to match sepcs.

## Analysis

It supports basic type checking, `break`, `continue`, `case` placement check, function return type checking, `if`/`while`/`do-while` condition type checking. See examples for what is supported in `test/Analysis`. It works based on the visitor pattern, just like code generation. There is a lot of work to do on this front to match sepcs.

## CodeGen

It takes in the AST generated by the parser, and using the visitor pattern visits the AST constructs and generates code for them. You can see a working fragment shader in `/example/passthrough_fragment.glsl`. Check `CodeGen/MLIRCodeGen.cpp` for constructs that are supported.

0 comments on commit f6f0dc0

Please sign in to comment.