Skip to content

Support arrow functions (=>)#39

Merged
memburg merged 1 commit into
mainfrom
issue-33-arrow-functions
Jun 11, 2026
Merged

Support arrow functions (=>)#39
memburg merged 1 commit into
mainfrom
issue-33-arrow-functions

Conversation

@memburg

@memburg memburg commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Add support for arrow function expressions, one of the most commonly used features in modern JavaScript.

  • Basic expression-body arrow: (a, b) => a + b
  • Block-body arrow: (a, b) => { return a + b; }
  • Single-parameter without parens: x => x * 2
  • No-parameter: () => 42

Changes:

  • Add Arrow token to tokenizer for => syntax
  • Add ArrowFunctionExpr AST node
  • Parse arrow functions in expression parser with backtracking
  • Support both expression-body (implicit return) and block-body arrows
  • Evaluate arrow functions by creating UserFunction values

Closes #33

- Add Arrow token to tokenizer for '=>' syntax
- Add ArrowFunctionExpr AST node
- Parse arrow functions: () => expr, x => expr, (a,b) => expr
- Support both expression-body and block-body arrow functions
- Evaluate arrow functions by creating UserFunction with implicit return

Closes #33
@memburg memburg added the enhancement New feature or request label Jun 11, 2026
@memburg memburg self-assigned this Jun 11, 2026
@memburg memburg merged commit 4e72fde into main Jun 11, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support arrow functions (=>)

1 participant