/Snark-parser

Snark parser component using PEG.js

Primary LanguageJavaScript

Snark parser

Snark parser component with PEG.js

Currently under pre-alpha, very naive implementation.

Test

$ npm install && npm test

Milestones

Syntax

  • Line break semantics

  • Literal

    • Identifier

      • Normal identifier

      • Exclude reserved keywords

      • Private identifier

        • Basic identifier

        • Uint-like identifier

        • Computed property identifier

    • Keyword literal

    • Number literal

      • Decimal literal

      • Exponent

      • Hex/Octal/Binary literal

      • Ignore _

    • String literal

      • Single line

      • Single line across multiple source line

      • Multiple line

    • Template string literal

      • Single line

      • Single line across multiple source line

      • Multi line

    • Object literal

      • Detect curly brace

      • Shorthand property

      • Property with value

      • Spread property

    • Array literal

      • Detect square bracket

      • Element

      • Spread element

      • Key-value pair element

    • Range literal

      • Inclusive range

      • Exclusive range

    • Assignment pattern

      • Identifier pattern

      • Object pattern

      • Array pattern

  • Module

    • Export

      • Default export

      • Named export

      • Export with alias

      • Declaration export

      • Bypass export

    • Import

      • Restricted to top

      • Default import

      • Named import

      • Import with alias

      • Namespace import

      • Zero variable import

    • Import from environment

      • Import global object

      • Import global variable

      • Import well-known symbol

      • Import shortcut identifier

  • Expression

    • Arithmetic operator

    • Logical operator

    • Comparison operator

    • Function call

    • Object property

    • Virtual method

    • Collection getter

    • Collection setter

    • Existential operator

      • Property access

      • Function call

      • Collection getter

      • Collection setter

    • Switch expression

      • Equality condition

      • Pattern matching condition

      • Non-param switch expression

    • In operator

      • Simple matching

      • Matching with extraction

    • As operator

    • Function expression

      • Single argument

      • Multiple argument

      • Shorthand function

    • Do expression

      • Normal do expression

      • Async do expression

      • Generator do expression

    • Suspension expression

      • Yield

      • Await

    • Class

      • Class method

      • Class property

      • Static property

      • Class constructor

  • Statement

    • Assignment statement

    • Declaration statement

      • Immutable variable

      • Mutable variable

      • Function declaration

      • Class declaration

    • If statement

      • Else block
    • While statement

    • For of statement

      • Async for-of statement
    • Enum statement