Skip to content

Add AST section to examples #545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 78 commits into
base: ppx-by-example
Choose a base branch
from

Conversation

pedrobslisboa
Copy link

@pedrobslisboa pedrobslisboa commented Dec 15, 2024

41 files where: 20 are pngs and 8 are old examples files deleted. So don't be scared

Captura de Tela 2024-12-15 às 19 11 58
Captura de Tela 2024-12-15 às 19 12 57

Description

This is the first part of adding the ppx-by-example to ppxlib
I will divide it into PR so we can review it better, focusing on the explanation and typos without having tons of files to review. It is really necessary that this section is easy to understand and is aligned with ppxlib.
@NathanReb Can you create a ppx-by-example base branch? So I can point this one to it, and after all merges (Other sections) on this branch, we move with the entire ppx-by-example branch to main?

AST

This PR adds the AST sections AST / Building ASTs / Destructing ASTs

How to test it (It's important to check it not only by code but also as styles)

  • At this branch run
     make doc
     open _build/default/_doc/_html/ppxlib/index.html
  • Access Examples
  • Access each section:
    • AST
    • Building an AST
    • Destructing an AST

Makefile Outdated
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NathanReb I've made some improvements on Makefile, can you check out if it makes sense?

The main feature is to add doc-dev, but I also added the help command

@pedrobslisboa
Copy link
Author

pedrobslisboa commented Dec 23, 2024

@patricoferris Tagging you for the review as you reacted to this PR

doc/dune Outdated
Comment on lines 10 to 12
(system "mkdir -p %{project_root}/_doc/_html/ppxlib/assets/images")
(system "cp -R ./images/ %{project_root}/_doc/_html/ppxlib/assets/images/"))))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, I didn't know any other way to get assets on odoc. Do you guys happen to know?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NathanReb @patricoferris I know that Odoc v3 supports it; maybe there is no alternative other than due to a hack similar to this one. Do you guys know a better hack?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, this hack will unfortunately not work for the documentation generated for ocaml.org.

The proper way to do it is to:

  • install the image files in the odoc-pages folder of the doc (see this example for how to do it with dune)
  • Include it with the odoc3 syntax, in your case {image!filename.png}

The tooling support for for odoc 3 is still under construction, so dune won't yet be able to build the documentation with the images... however, odoc_driver can and soon dune and ocaml.org will be able to do it! You would be one of the first users of images the odoc 3 way!

(Another way to do it is to use permalinks to the image eg {image:https://github.com/ocaml-ppx/ppxlib/<hash>/filename.png})

I also wonder if turning some images into text wouldn't be better for accessibility.

@pedrobslisboa pedrobslisboa force-pushed the examples/ast branch 5 times, most recently from 7bf1887 to 2aeef20 Compare December 27, 2024 21:12
@NathanReb
Copy link
Collaborator

@pedrobslisboa just pushed a ppx-by-example branch, sorry for the delay!

@pedrobslisboa pedrobslisboa changed the base branch from main to ppx-by-example January 6, 2025 21:33
patricoferris and others added 25 commits February 18, 2025 09:39
Fix traverse sexp tests after 5.2 AST merge
Location.none has been changed to match the compiler's Location.none as
of OCaml 4.08 which has been stable for some time. Since ppxlib only
supports compilers greater than or equal to 4.08 we do not need to
handle other possible none location values.

Signed-off-by: Patrick Ferris <[email protected]>
Signed-off-by: Patrick Ferris <[email protected]>
Add  `[@@@expand_inline]` and support for floating attribute context free transformations
Signed-off-by: Nathan Rebours <[email protected]>
Signed-off-by: Nathan Rebours <[email protected]>

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…ation

Fix location inserted when migrating constants from 5.2 to 5.3
There are only two significant changes to the AST from 5.2 to 5.3: the
addition of a dedicated effects AST node and constant nodes getting a
location. The latter will likely be the most impacting change to
downstream dependencies of ppxlib.

Signed-off-by: Patrick Ferris <[email protected]>
Signed-off-by: Patrick Ferris <[email protected]>
Signed-off-by: Patrick Ferris <[email protected]>
This patch introduces a new GitHub Actions workflow with dune package management. It'd help us ensure ppxlib builds with dune PM.

Signed-off-by: Sudha Parimala <[email protected]>
Add a dune package management GHA workflow
While we want to keep an eye on this, we don't want to make it a hard requirement

Signed-off-by: Sudha Parimala <[email protected]>
Signed-off-by: Pedro B S Lisboa <[email protected]>
Signed-off-by: Pedro B S Lisboa <[email protected]>
Signed-off-by: Pedro B S Lisboa <[email protected]>
Signed-off-by: Pedro B S Lisboa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants