Skip to content

Reimplement the parser #225

Closed
Closed

Description

@yovoslav

In its current implementation, the parser works recursively, which is fine if you are doing simple expression parsing. But once you start parsing a long series of tokens, a stack overflow may occur (such is the case in #162).

What I propose is to start reimplementing the parser in small logical chunks. This includes:

  • eliminating recursive calls and making the parsing iterative
  • trying to keep the expressions as linear as possible (e.g. binary operators being represented in reverse polish notation, instead of a tree)

As I said, the work can be split into small chunks, such as:

  • var
  • let
  • const
  • return
  • functions
  • blocks
  • new
  • if, else if, else & ternary
  • loops
  • objects
  • arrays
  • switch
  • typeof
  • binary operators
  • unary operators
  • regular expressions

Note: this list might not be exhaustive

Activity

  1. jasonwilliams commented on Mar 10, 2020

    @jasonwilliams
    Member

    Good to match up with https://tc39.es/ecma262/#sec-ecmascript-language-lexical-grammar

    Good to support concurrent tokens coming through channel.

    good to be broken out into functions for specific expressions.

  2. added
    C-Parser
    on Mar 31, 2020
  3. jasonwilliams commented on Mar 31, 2020

    @jasonwilliams
    Member

    @IovoslavIovchev whats the state of this issue now that the parser has been rebuilt?
    There is conversation on how we break the parser up happening jasonwilliams#281 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C-Parser

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions