# V0001 syntax_error

URL: /docs/errors/V0001
Markdown: /docs/errors/V0001.md

> The parser expected a different token, or a delimiter was never closed.

An error from the `parse` phase. `sakura explain V0001` prints this explanation offline.

The parser expected a different token, or a delimiter was never closed.

The parser recovers and keeps going, so later diagnostics may be cascades of this one;
fix this one first.

Wrong:

```sakura
fn main() -> Unit ! {Console} { Console.print("hi" }
```

Fixed:

```sakura
fn main() -> Unit ! {Console} { Console.print("hi") }
```

## Wrong program [#wrong-program]

[`compiler/tests/ui/V0001_unterminated_call.sakura`](https://github.com/icantcodefyi/sakuralang/blob/master/compiler/tests/ui/V0001_unterminated_call.sakura), which the compiler's ui suite runs through `sakura check`:

```sakura
fn greet(name: String) -> Unit ! {Console} {
  Console.print(
}
pub fn main() -> Unit ! {Console} { greet("Sakura Lang") }
```

`sakura check --json` reports this record (pretty-printed; `$DIR` is the fixture's directory):

```json
{
  "schema_version": "1.0",
  "kind": "diagnostic",
  "id": "d:bb7e1e6404c205d9",
  "code": "V0001",
  "severity": "error",
  "phase": "parse",
  "message": "expected `)`, found `}`",
  "snapshot": "sha256:$SNAPSHOT",
  "symbol_id": "main::V0001_unterminated_call::greet",
  "spans": [
    {
      "uri": "file://$DIR/V0001_unterminated_call.sakura",
      "content_hash": "sha256:ca0c643e96a96f91bfafb2d64e00c1ef9c1d777b96c2ee5620e4dbd57794b472",
      "start_byte": 96,
      "end_byte": 97,
      "role": "primary"
    }
  ],
  "related_ids": [],
  "expected": null,
  "actual": null,
  "obligation": null,
  "counterexample": null,
  "explanation_uri": "sakura://explain/V0001",
  "fixes": []
}
```

## Fixed program [#fixed-program]

[`compiler/tests/ui/V0001_unterminated_call.fixed.sakura`](https://github.com/icantcodefyi/sakuralang/blob/master/compiler/tests/ui/V0001_unterminated_call.fixed.sakura), which `sakura check` accepts with no diagnostics:

```sakura
fn greet(name: String) -> Unit ! {Console} { Console.print("hello, {name}") }

pub fn main() -> Unit ! {Console} { greet("Sakura Lang") }
```
