Repository: CrossGL/crosstl

Issue:
Add Parsing for `Double`  Data Type Token
Update the parser to handle the DOUBLE token, allowing it to correctly parse variables and operations involving the double data type.

Discussion:
samthakur587: hii @rigved-desai can you please resolve the merge conflicts 😄 
rigved-desai: > hii @rigved-desai can you please resolve the merge conflicts 😄

Done 👍 

Patch:
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
new file mode 100644
index 0000000..32aefc7
--- /dev/null
+++ b/.github/CODEOWNERS
@@ -0,0 +1,5 @@
+* @NripeshN
+
+crosstl/* @samthakur587 @vaatsalya123
+
+tests/* @samthakur587
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 4c3d892..c75ed28 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,4 +1,3 @@
-```markdown
 ### PR Description
 <!-- Provide a brief summary of the changes you have made. Explain the purpose and motivation behind these changes. -->
 
@@ -47,4 +46,3 @@ shader PerlinNoise {
 - [ ] Are all tests passing?
 
 
-```
diff --git a/.github/workflows/auto-assign-issues.yml b/.github/workflows/auto-assign-issues.yml
new file mode 100644
index 0000000..063f6d9
--- /dev/null
+++ b/.github/workflows/auto-assign-issues.yml
@@ -0,0 +1,18 @@
+name: Auto-Assign Issues
+
+on:
+  issue_comment:
+    types: [created]
+
+jobs:
+  assign_issue:
+    runs-on: ubuntu-latest
+    steps:
+    - name: Check if the comment is requesting assignment
+      if: github.event.comment.body == 'assign to me'
+      run: |
+        gh api \
+          -X POST \
+          -H "Accept: application/vnd.github+json" \
+          /repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees \
+          -d '{"assignees":["${{ github.event.comment.user.login }}"]}'
diff --git a/README.md b/README.md
index 51ffd77..29cbbd8 100644
--- a/README.md
+++ b/README.md
@@ -272,7 +272,7 @@ your contributions are definitely welcome and appreciated 🙌
 find out more info in our [Contributing guide](https://crossgl.github.io/contribution.html)
 
 <a href="https://github.com/CrossGL/crosstl/graphs/contributors">
-  <img class="dark-light" src="https://contrib.rocks/image?repo=CrossGL/crosstl&anon=0&columns=20&max=100&r=true" />
+  <img src="https://contrib.rocks/image?repo=CrossGL/crosstl" />
 </a>
 
 
diff --git a/crosstl/src/translator/parser.py b/crosstl/src/translator/parser.py
index c62c6b1..51ad041 100644
--- a/crosstl/src/translator/parser.py
+++ b/crosstl/src/translator/parser.py
@@ -90,6 +90,8 @@ class Parser:
             if self.current_token[0] in [
                 "VECTOR",
                 "FLOAT",
+                "DOUBLE",
+                "UINT",
                 "INT",
                 "SAMPLER2D",
                 "MATRIX",
@@ -98,7 +100,7 @@ class Parser:
                 self.eat(self.current_token[0])
             else:
                 raise SyntaxError(
-                    f"Expected VECTOR, FLOAT, INT, or SAMPLER2D, got {self.current_token[0]}"
+                    f"Expected VECTOR, FLOAT, DOUBLE, UINT, INT or SAMPLER2D, got {self.current_token[0]}"
                 )
             name = self.current_token[1]
             self.eat("IDENTIFIER")
@@ -157,7 +159,15 @@ class Parser:
             elif self.current_token[0] == "FRAGMENT":
                 fragment_section = self.parse_shader_section("FRAGMENT")
                 self.skip_comments()  # Skip comments while parsing functions
-            elif self.current_token[0] in ["VECTOR", "FLOAT", "INT", "VOID", "MATRIX"]:
+            elif self.current_token[0] in [
+                "VECTOR",
+                "FLOAT",
+                "DOUBLE",
+                "UINT",
+                "INT",
+                "VOID",
+                "MATRIX",
+            ]:
                 global_functions.append(self.parse_function())
                 self.skip_comments()  # Skip comments while parsing functions
             else:
@@ -202,7 +212,8 @@ class Parser:
             elif self.current_token[0] == "OUTPUT":
                 outputs.extend(self.parse_outputs())
             elif (
-                self.current_token[0] in ["VECTOR", "FLOAT", "INT", "VOID", "MATRIX"]
+                self.current_token[0]
+                in ["VECTOR", "FLOAT", "DOUBLE", "UINT", "INT", "VOID", "MATRIX"]
                 and self.peak(2)[0] == "LPAREN"
             ):
                 functions.append(self.parse_function())
@@ -214,6 +225,8 @@ class Parser:
                 "VECTOR",
                 "IDENTIFIER",
                 "FLOAT",
+                "DOUBLE",
+                "UINT",
                 "INT",
                 "MATRIX",
             ]:
@@ -248,6 +261,8 @@ class Parser:
             if self.current_token[0] in [
                 "VECTOR",
                 "FLOAT",
+                "DOUBLE",
+                "UINT",
                 "INT",
                 "MATRIX",
                 "SAMPLER2D",
@@ -256,7 +271,7 @@ class Parser:
                 self.eat(self.current_token[0])
             else:
                 raise SyntaxError(
-                    f"Expected VECTOR, FLOAT, INT, MATRIX, or SAMPLER2D, got {self.current_token[0]}"
+                    f"Expected VECTOR, FLOAT, DOUBLE, UINT, INT, MATRIX, or SAMPLER2D, got {self.current_token[0]}"
                 )
             name = self.current_token[1]
             self.eat("IDENTIFIER")
@@ -285,6 +300,8 @@ class Parser:
             if self.current_token[0] in [
                 "VECTOR",
                 "FLOAT",
+                "DOUBLE",
+                "UINT",
                 "INT",
                 "MATRIX",
                 "SAMPLER2D",
@@ -293,7 +310,7 @@ class Parser:
                 self.eat(self.current_token[0])
             else:
                 raise SyntaxError(
-                    f"Expected VECTOR, FLOAT, INT, MATRIX, or SAMPLER2D, got {self.current_token[0]}"
+                    f"Expected VECTOR, FLOAT, DOUBLE, UINT, INT, MATRIX, or SAMPLER2D, got {self.current_token[0]}"
                 )
             name = self.current_token[1]
             self.eat("IDENTIFIER")
@@ -386,14 +403,22 @@ class Parser:
         if self.current_token[0] == "VOID":
             self.eat("VOID")
             return "void"
-        elif self.current_token[0] in ["VECTOR", "FLOAT", "INT", "MATRIX", "SAMPLER2D"]:
+        elif self.current_token[0] in [
+            "VECTOR",
+            "FLOAT",
+            "DOUBLE",
+            "UINT",
+            "INT",
+            "MATRIX",
+            "SAMPLER2D",
+        ]:
             vtype = self.current_token[1]
             self.eat(self.current_token[0])
             return vtype
         elif self.current_token[0] == "IDENTIFIER":
             type_name = self.current_token[1]
             self.eat("IDENTIFIER")
-            if type_name in ["int", "float"]:
+            if type_name in ["int", "uint", "float", "double"]:
                 return type_name
             return type_name
         else:
@@ -417,7 +442,14 @@ class Parser:
                 body.append(self.parse_for_loop())
             elif self.current_token[0] == "RETURN":
                 body.append(self.parse_return_statement())
-            elif self.current_token[0] in ["VECTOR", "IDENTIFIER", "FLOAT", "INT"]:
+            elif self.current_token[0] in [
+                "VECTOR",
+                "IDENTIFIER",
+                "FLOAT",
+                "DOUBLE",
+                "UINT",
+                "INT",
+            ]:
                 body.append(self.parse_assignment_or_function_call())
             else:
                 raise SyntaxError(f"Unexpected token {self.current_token[0]}")
@@ -563,7 +595,14 @@ class Parser:
         """
         type_name = ""
         inc_dec = False
-        if self.current_token[0] in ["VECTOR", "FLOAT", "INT", "MATRIX"]:
+        if self.current_token[0] in [
+            "VECTOR",
+            "FLOAT",
+            "DOUBLE",
+            "UINT",
+            "INT",
+            "MATRIX",
+        ]:
             type_name = self.current_token[1]
             self.eat(self.current_token[0])
         if self.current_token[0] == "IDENTIFIER":
@@ -810,6 +849,8 @@ class Parser:
             "IDENTIFIER",
             "VECTOR",
             "FLOAT",
+            "DOUBLE",
+            "UINT",
             "INT",
             "MATRIX",
         ]:
@@ -908,7 +949,14 @@ class Parser:
             ASTNode: An ASTNode object representing the function call or identifier
 
         """
-        if self.current_token[0] in ["VECTOR", "FLOAT", "INT", "MATRIX"]:
+        if self.current_token[0] in [
+            "VECTOR",
+            "FLOAT",
+            "DOUBLE",
+            "UINT",
+            "INT",
+            "MATRIX",
+        ]:
             func_name = self.current_token[1]
             self.eat(self.current_token[0])
         else:
diff --git a/setup.py b/setup.py
index 95752f3..2acb8f8 100644
--- a/setup.py
+++ b/setup.py
@@ -31,6 +31,6 @@ setup(
         "Programming Language :: Python :: 3",
         "Operating System :: OS Independent",
     ],
-    python_requires=">=3.10",
+    python_requires=">=3.8",
     install_requires=["gast", "pytest"],
 )


Test patch:
diff --git a/.github/workflows/backend-tests.yml b/.github/workflows/backend-tests.yml
index b3a758d..f67ad70 100644
--- a/.github/workflows/backend-tests.yml
+++ b/.github/workflows/backend-tests.yml
@@ -14,6 +14,7 @@ jobs:
     strategy:
       matrix:
         backend: [directx, metal, opengl] # ToDO: Add mojo to the list
+        python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
 
     steps:
     - name: Checkout repository
@@ -22,7 +23,7 @@ jobs:
     - name: Set up Python
       uses: actions/setup-python@v5
       with:
-        python-version: '3.10'
+        python-version: ${{ matrix.python-version }}
 
     - name: Install dependencies
       run: |
diff --git a/.github/workflows/translator-tests.yml b/.github/workflows/translator-tests.yml
index ec3f7f4..06abd02 100644
--- a/.github/workflows/translator-tests.yml
+++ b/.github/workflows/translator-tests.yml
@@ -14,6 +14,7 @@ jobs:
     strategy:
       matrix:
         component: ['directx', 'metal', 'opengl', 'general']  # ToDo: Add 'mojo' to the list
+        python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
 
     steps:
     - name: Checkout repository
@@ -22,7 +23,7 @@ jobs:
     - name: Set up Python
       uses: actions/setup-python@v5
       with:
-        python-version: '3.10'
+        python-version: ${{ matrix.python-version }}
 
     - name: Install dependencies
       run: |
diff --git a/tests/test_backend/__init__.py b/tests/test_backend/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/test_backend/test_directx/__init__.py b/tests/test_backend/test_directx/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/test_backend/test_metal/__init__.py b/tests/test_backend/test_metal/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/test_backend/test_opengl/__init__.py b/tests/test_backend/test_opengl/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/test_translator/test_parser.py b/tests/test_translator/test_parser.py
index ab39356..a12a3ad 100644
--- a/tests/test_translator/test_parser.py
+++ b/tests/test_translator/test_parser.py
@@ -244,3 +244,40 @@ def test_logical_operators():
         parse_code(tokens)
     except SyntaxError:
         pytest.fail("Struct parsing not implemented.")
+
+
+def test_var_assignment():
+    code = """
+    shader PerlinNoise {
+    vertex {
+        input vec3 position;
+        output vec2 vUV;
+
+        void main() {
+            vUV = position.xy * 10.0;
+            gl_Position = vec4(position, 1.0);
+        }
+    }
+
+    // Fragment Shader
+    fragment {
+        input vec2 vUV;
+        output vec4 fragColor;
+
+        void main() {
+            double noise = fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453);
+            double height = noise * 10.0;
+            uint a = 1;
+            uint b = 2;
+            vec3 color = vec3(height / 10.0, 1.0 - height / 10.0, 0.0);
+            fragColor = vec4(color, 1.0);
+            }
+        }
+    }
+
+    """
+    try:
+        tokens = tokenize_code(code)
+        parse_code(tokens)
+    except SyntaxError:
+        pytest.fail("Variable assignment parsing not implemented.")