Documentation

PT002

Back to documentation index
{
  "@context": "https://nxdlang.org/schema",
  "doc_id": "PT002",
  "title": "",
  "description": "NXD Compiler Testing Notes - Nim",
  "layer": "Passed Tests",
  "category": "Passed Tests",
  "keywords": [Transpilation, Compiler, Nim], 
  "doc_version": "1.0",
  "status": "active"
}

# PT002

### NXD Sample:

```nxd
MODULE TEST

FUNC MAIN():
    RETURN 1
```    

### Result:

COMPILER: PASS
SEMANTICS: PASS

Failure Stage:

N/A

### Expected Output:

```json 
{
  "module": {
    "name": "TEST",
    "imports": []
  },
  "types": [],
  "functions": [
    {
      "name": "MAIN",
      "params": [],
      "return_type": null,
      "body": [
        {
          "kind": "return",
          "value": {
            "kind": "literal",
            "value": 1
          }
        }
      ]
    }
  ]
}
```

Actual Output:

```json
{
  "module": {
    "name": "TEST",
    "imports": []
  },
  "types": [],
  "functions": [
    {
      "name": "MAIN",
      "params": [],
      "return_type": null,
      "body": [
        {
          "kind": "return",
          "value": {
            "kind": "literal",
            "value": 1
          }
        }
      ]
    }
  ]
}
```

### Notes:

Confirmed function declaration parsing, return statement parsing, integer literal parsing, AST lowering, and IR JSON generation.