sunjay / brain

A high level programming language that compiles into the brainfuck esoteric programming language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pattern Matching and Match Statements

sunjay opened this issue · comments

Pretty much required to make #41 usable.

  • new match statement added to grammar
  • pattern matching on struct fields, tuples, enum variants, etc.
  • Ignore struct fields with ..
  • Wildcard _ or identifier to match all
  • Multiple patterns separated by |
  • Bind names with @
  • irrefutable patterns can be used in assignment or as function parameters

Reference: