dlang / project-ideas

Collection of impactful projects in the D ecosystem
36 stars 12 forks source link

pegged parse tree to AST + visitor #77

Closed ghost closed 5 months ago

ghost commented 3 years ago

Description

Pegged allows to describe how to parse an input. Unfortunatly it produces a parse tree, not an AST. This difference puts limits on the usability of the library.

The goals of the project are to

  1. generate the AST classes from a PEG grammar
  2. generate a prototype visitor
  3. create a function that turns a parse tree, as produces by Pegged, to a visitable AST

What are rough milestones of this project?

Pretty much the same as the goals.

How does this project help the D community?

Plenty of structured textual file formats would be much more easily usable.

Recommended skills

metaprogramming, CTFE, OOP, parsing.

What can students expect to get out of doing this project?

Point of Contact

to be determined

References

to be determined

burner commented 3 years ago

my ll(1)+ parser generator https://code.dlang.org/packages/darser does this.

ghost commented 3 years ago

darser looks nice. to be honest I would have personal interests into what I propose but I might use darser instead.

burner commented 3 years ago

@JarkkoMukka have a look at the usage of darser in graphqld here https://github.com/burner/graphqld/blob/master/Makefile#L24

thats properly the best use case/example I have. Issue's and PR's always welcome!

RazvanN7 commented 3 years ago

I am going to remove gsoc2021 as this project does not have a mentor and the original author has deleted his account. This will not look well in the eyes of GSOC evaluators.

benjones commented 3 years ago

I'll just post a link to a project I started which i sort of related, probably not SOC appropriate, but maybe? You annotate your AST nodes with PEG-like syntax descriptions and the lib gives you a recursive descent parser that produces those AST nodes directly. Might provide inspiration, or be useful somehow? https://github.com/benjones/autoparsed

RazvanN7 commented 12 months ago

This has been worked on by Adela Vais. As far as I remember the project was completed.

PetarKirov commented 12 months ago

@RazvanN7 I think that every issue that is closed as completed should have a link to repository / commit that resolves it. Say someone is working on a task that assumes this one is complete - if they need to code where can they find it?

mdparker commented 5 months ago

Adela Vais's work was merged into Bison. There's no reason to have this open anymore.