Code Monkey home page Code Monkey logo

ideas's Introduction

ideas's People

Contributors

christianmurphy avatar wooorm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ideas's Issues

Semantic version control

SemanticMerge is a version control tool based on syntax trees. I haven't tried it personally, but it seems really nice. Unlike git, for example, the diffing algorithm is able to consider the structure of the language to make smarter merges. It supports adding external parsers. It would be awesome to be able to convert unist syntax trees to SemanticMerge format.

BBCode AST

Considering there is already hast for HTML, I think an HTML-derived language like BBCode could also be implemented with some of the tweaks from generating HTML syntax trees.

The differences between BBCode and HTML is that the former:

  • Can have custom tags
  • Has a different implementation of certain tags, such as url ([url]https://example.com[/url] and [url=https://example.com]Foobar[/url]) img ([img]https://example.com/image.jpg[/img])
    Relevant links:
  • https://www.phpbb.com/community/help/bbcode

WARC AST

I'd bee great to have an Abstract Syntax Tree for WARC files since sometimes can become huge and searching through all the file is tedious.
I would do it myself but have no idea where to start.

C Language AST

I'm interested in doing some C Language parsing / transformations / compilation within a browser environment. I was curious if the unified js ecosystem would be a good fit, to tie into something standardized instead of doing ad hoc development.

If I'm understanding the current ecosystem, C might fit in as:

  • cast: Specification for a C AST in unist format.
  • rec: C processor
    • rec-parse: Parse C files into syntax trees
  • cast-to-x86: A utility to compile a C AST into an assembly language. (Example of something related to compilation. Maybe it would be more flexible to have another AST for x86 in this example, instead of directly going from C AST to assembly instructions?)

Document syntax trees

When working with trees, there are several tasks that occur a lot. And there’s jargon for those tasks. Explaining jargon in of course needed. Having those explanations in one place makes it easier to update, an gives a good introduction to syntax trees/unist for newcomers.
Using jargon is nice for utilities and others tools so they don’t have to explain everything all the time.

Current efforts

One effort to do that is the Glossary and Tree traversal appendices of unist.
As raised in syntax-tree/unist#25, the appendices are growing and it may be time to move them somewhere else.

Design

The form this takes could be either more technical, or more beginner friendly. In the latter case, it could be a bit like the introduction of the babel handbook.

It could be a readme file. Or it could be a guide on unified.js.org. Or it could be a GitBook / Docusaurus project.

Additional resources

ast utility function to create selector from passing a root and a leaf node.

it would be nice to have a utility to create a selector from a root.

E.g. selectorFromTree(root, node); // returns html > body > div:nth-child(1) > h1

which in turn you could then use something like https://github.com/syntax-tree/hast-util-select

later to find that same node.

the use case I'm using this for is dragging and dropping AST Nodes in a tree and looking them up by paths for mutation of the AST.

CC: @wooorm

I would personally work on this, but I don't think I know enough about AST manipulation to write a helper like this efficiently.

Proposal for mdxast

We've been working on a Markdown + JSX project, c8r/markdown where we've been blurring the lines between markdown and JSX. Then this discussion made me realize that a lot of folks are working on very similar projects that seek to also blur these lines, an MDX, if you will.

A specification

I've put a few minutes into an mdx specification.

How would it work?

Ideally, this will essentially blend the MDAST and HAST syntax trees.
Perhaps maintaining all MDAST specific nodes and introducing some new type of node.
Maybe the two trees could even be merged.

Unsurprisingly, the lion share of the work will exist on the parsing side.

Why

As rauchg mentioned in his .mdx proposal linked above, having an AST will allow us to better handle syntax highlighting, linting and code formatting. This AST spec could also help us arrive at a community solution with the numerous projects seeking similar goals.

Not to mention, MDXAST could leverage a lot of the great tooling and utilities built around MDAST and HAST.

Other considerations

Interleaving

Where this gets quite tricky is when thinking about the interleaving of md and jsx, like the following contrived example:

<Ul>
- Foo
- Bar
</Ul>

I'm currently using this project and have already run into difficulties with the notion of "interleaving".

Code blocks

This would also redefine how code blocks work, as currently with remark, block elements are predefined. This makes sense in the context of markdown, but wouldn't necessarily be the case in .mdx.


This is a project I will begin experimenting a bit with this week, and was wondering if you and the syntax-tree/remarkjs community were interested in.

Thanks for your time and any thoughts in advance.

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.