Comments (6)
Cool project! Thanks for reaching out.
From what I gather on the site, it looks like Loyc is one format of syntax tree, for all programming languages. You still need parsers (document > syntax tree) and compilers (syntax tree > document) for every language. But there’s one syntax tree. Correct?
Unist is a standard on how to describe syntax trees. It provides a few essentials, but allows differences. The markdown syntax tree is different from the HTML syntax tree.
Right now, there’s lots of different syntax tree formats out there, and each format needs their own set of utilities to manipulate and inspect. Because of Unist, there’s no need to create those utilities for each syntax tree, just once: for Unist.
from unist.
You still need parsers (document > syntax tree) and compilers (syntax tree > document) for every language. But there’s one syntax tree. Correct?
Sorry for taking awhile to respond. What you mean by 'document > syntax tree'?
Basically, yes, there is one syntax tree, and moreover there is a single preferred syntax (which will be LESv3 when it is completed). Any other programming language can, in principle, be encoded as a Loyc tree, but Enhanced C# is currently the only other language with a Loyc tree representation.
The rest is open-ended, and I haven't decided what to tackle next. My original idea was a single compiler framework that allows multiple input syntaxes (e.g. imagine mixing Java, Swift and C# code in one program). Another possibility is a system that converts code from one programming language to another. Unfortunately both of these ideas require a lot more manpower. (for one thing, a multi-language standard library seems to be needed for both of them.)
A seemingly easier idea is a WebAssembly interoperability framework (ABI) that uses LES as a common language for cross-language bindings. (The challenge there is my lack of experience with building low-level tools, and the fact that WebAssembly isn't standardized yet.)
What programming language are you using for the code in the readme?
interface Node {
type: string;
data: Data?;
position: Location?;
}
I guess this means "optional Data" and "optional Location"? So whereas a Loyc tree is "an identifier | literal | call node, plus a location and a list of attributes", A Unist is "a text | parent node, plus a location and some arbitrary Data and a type string". It seems like Unist is oriented around document storage, whereas Loyc trees are oriented around code. Yes?
from unist.
When it comes to document storage, I wonder, what's the advantage of Unist over a JSON encoding? (EDIT: sorry for misspelling Unist.)
from unist.
What you mean by 'document > syntax tree'
Here I define “document” as a file or fragment of a file. And “syntax tree” as a representation easily inspected by, and manipulated by, computers.
What programming language are you using for the code in the readme?
That’s WebIDL.
I guess this means "optional Data" and "optional Location"?
Yup!
It seems like Unist is oriented around document storage, whereas Loyc trees are oriented around code. Yes?
Unist and Loyc do different things, yes, but I’d say it differently: Unist is the interface of the tree, the format of the tree, what is expected at what keys, and what those keys mean. Loyc trees are one syntax tree for all programming languages.
Something else to consider is hast, and the like, which define a tree for one one programming language, based on Unist.
When it comes to document storage, I wonder, what's the advantage of Unist over a JSON encoding?
Unist, when represented in JavaScript, is just (parsed) JSON, yup! Probably in different languages too.
Think of Unist more as the schema and semantics.
Another possibility is a system that converts code from one programming language to another
That’s sort-of possible with this system too. Sure, the syntax trees are different, like hast for HTML and mdast for markdown, but remark-rehype can translate between the two trees: from markdown to HTML.
from unist.
@qwertie Did that help explain stuff? Can I close this?
from unist.
Yeah, I guess so. Some details are fuzzy to me, but my main question is answered, i.e., our projects are focused on different things.
from unist.
Related Issues (20)
- Empty children arrays HOT 1
- Would unist make a good programming language AST format? HOT 4
- A swiss army knife for Unist-util-*. HOT 5
- Using hast instead of mdast to describe markdown documents HOT 1
- Use proper naming for position/location HOT 3
- No utility for creating a selector from a root and a leaf node. HOT 1
- Specify `indent` HOT 3
- Rename abstract `text` interface to `literal` HOT 2
- `line`, `column`, and `offset` in `point` underspecified HOT 4
- What's the unit of character in Point HOT 7
- Add tree traversal methods to glossary
- Add `enter` and `exit` terms to glossary
- is it possible to insert a node or remove a node in ast tree? HOT 4
- More strict notion of JSON-stringifiability for all properties HOT 14
- Error at C:/web/node_modules/@types/unist/index.d.ts:92:58: ';' expected. HOT 8
- Stringifiability of other Node properties HOT 3
- Unist Test Suite HOT 3
- adast - asciidoc syntax tree HOT 5
- What is a `column` or `offset`, exactly?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unist.