Skip to content

AST #557

Closed
Closed

Description

@xiaq

fish doesn't yet have an AST. Blocks bodies are kept literally and parsed every time they are executed. This can have significant performance impact when one has a heavy loop, or a function that is invoked frequently.

Adding an AST will also probably make the code clearer in various places.

Activity

  1. ridiculousfish commented on Feb 2, 2013

    @ridiculousfish
    Member

    Yeah, a real parser would be sweet!

  2. ridiculousfish commented on Jan 13, 2014

    @ridiculousfish
    Member

    290aae8 is the first merge of the new parser I've been working on. It's turned on for syntax highlighting, completions, and abbreviations (but not yet the big one - execution).

    Here's the commit comment:

    Merge of "ast" branch, providing fish with a unified parser, used for execution, syntax coloring, completions, abbreviations, etc. This also bestows fish with a formalized grammar, which is 'documented' in a comment in parse_tree.h.

    The parser here is a LL(2) parser, which is handwritten (to avoid complicating the build process and to maintain good control over error reporting, thread safety, etc). Later it's worth exploring using parser generators (lemon, etc) or other tools to simplify things.

    This commit enables the new parser for syntax highlighting, completions, and abbreviations. Syntax highlighting retains the old implementation (disabled), which will be removed shortly. There is also support for a new execution model, based on the new parser, but it is disabled by default (can be enabled by setting the fish_new_parser variable to 1).

    There's also lots of new tests, and some machinery for selecting which tests to run.

    After living on this commit for a while, we'll enable the new execution model by default, and then begin to tear down the machinery of the old one (the block types, builtin_end, the parser_t junk, etc.). After that we can pursue even more exotic execution models, like multithreaded ones.

    (The branch name is really a misnomer - the tree here is a parse tree, or concrete syntax tree, not an abstract one.)

  3. siteshwar commented on Jan 14, 2014

    @siteshwar
    Contributor

    @ridiculousfish Awesome !

  4. added a commit that references this issue on Mar 2, 2014
    0e991c5
  5. modified the milestones: , fish-future on Jul 14, 2014
  6. locked as resolved and limited conversation to collaborators on Apr 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions