Giter Site home page Giter Site logo

pathos's Introduction

Pathos: A Python Parser [DEAD]

This was my attempt at writing a recursive-decent parser by hand, for the python source code.

It worked fairly well (for a subset of code) but it was large and clunky.

I have since decided to try and avoid hand-written parsers ;)

Parser generators

If you're into parser generators, take a look at:

  1. parol - LL(k)
  2. pest - PEG
  3. tree-sitter - LR(1)
  4. lalrpop LR(1) or LALR(1)
  5. Antlr - Amazing magic but Rust bindings are experimental :(

If you're into parser combinators, take a look at:

  1. combine - Looks neat
  2. chumsky - Excellent error recovery and messagses
  3. nom - Stable

ASTs

I did some work on ASDLR ASTs here. That has since moved to a seperate project.

pathos's People

Contributors

techcable avatar

Watchers

 avatar

pathos's Issues

Error recovery

This is a nice-to-have feature, which isnt very useful in the context of an interpreter.

I think the only technique I would reasonably use is panic mode.

Recovering from mismatched tokens and lexer errors would be hard (especially with logos), but other types of unexpected tokens should be easier.

We should also consider switching entirely to aridane for errors, although that's really a separate issue.

Use zerogc for allocation

This will allow python code to access the generated AST, hopefully obseleting the CPython 'ast' module. Note that I've made a few changes from the CPython AST that would complicate this integration (we would have to add some sort of wrapper objects).

It will also allow the parser and bytecode compiler to use garbage collected collections like hashmaps, which would otherwise need to be allocated with malloc.

Hopefully this will also reduce memory usage of the parser and maybe even increase speed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.