Skip to content

Version 0.0.3

Choose a tag to compare

@Samathingamajig Samathingamajig released this 05 Feb 18:54
· 32 commits to main since this release

This implements a simple lexer and simple parser.

Tokens:

  • PLUS = +
  • MINUS = -
  • ASTERISK = *
  • F_SLASH = /
  • OPEN_PAREN (not parseable yet) = (
  • CLOSE_PAREN (not parseable yet) = )
  • NUMBER = /d+
  • EEOF = \0
  • UNKNOWN = (anything else)

Syntax:

expr     : term ((PLUS|MINUS) term)*

term     : factor ((ASTERISK|F_SLASH) factor)*

factor   : NUMBER