# Parser bug(?): syntax: extra token after end of expression

**URL:** https://discourse.julialang.org/t/parser-bug-syntax-extra-token-after-end-of-expression/97832
**Category:** Internals & Design
**Created:** [April 23, 2023, 11:01pm UTC](https://discourse.julialang.org/t/parser-bug-syntax-extra-token-after-end-of-expression/97832 "2023-04-23T23:01:25Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)
#### Post date: [April 23, 2023, 11:01pm UTC](https://discourse.julialang.org/t/parser-bug-syntax-extra-token-after-end-of-expression/97832/1 "2023-04-23T23:01:25Z")

</div>

These two statements error, even though they seem unambiguous:

```julia
julia> begin
         () -> 3
       end()
ERROR: syntax: extra token "(" after end of expression
Stacktrace:
 [1] top-level scope
   @ none:1

julia> function()
         3
       end()
ERROR: syntax: extra token "(" after end of expression
Stacktrace:
 [1] top-level scope
   @ none:1

```

Adding extra parentheses fixes the issue:

```julia
julia> (begin
         () -> 3
       end)()
3

julia> (function()
         3
       end)()
3

```

The JuliaSyntax package has this same behavior as the built-in Julia parser.
