breck7 / jtree Goto Github PK
View Code? Open in Web Editor NEWBuild your own language using Tree Notation.
Home Page: http://jtree.treenotation.org
Build your own language using Tree Notation.
Home Page: http://jtree.treenotation.org
import header.scroll permalink index.html title JTree: Tree Notation SDK for TypeScript & Javascript startColumns 4 import ciBadges.scroll # Links Tree Notation Homepage https://treenotation.org Tree Notation Sandbox https://jtree.treenotation.org/sandbox Tree Language Designer https://jtree.treenotation.org/designer Release Notes https://jtree.treenotation.org/releaseNotes.html Tree Notation FAQ https://faq.treenotation.org TrueBase https://truebase.pub/ TypeScript Library https://github.com/treenotation/jtree Tree Notation Subreddit https://reddit.com/r/treenotation Ohayo - A data science studio powered by Tree Notation https://github.com/treenotation/ohayo UnitTests https://jtree.treenotation.org/sandbox/test.html PerfTests https://jtree.treenotation.org/sandbox/perfTests.html ? Who is this package built for? Jtree is for people who want to design Tree Languages, make Tree editing tools, or use the Tree Component Web Framework. You can think of jtree as similar to the Java Development Kit, except for Tree Notation instead of Java. ? How do I build a new language? You can try the Grammar tutorial. link grammarTutorial.html Grammar tutorial # Grammar Files Jtree contains a Tree Language called "Grammar". You can write new Grammar files to define new languages. By creating a grammar file you get a parser, a type checker, syntax highlighting, autocomplete, a compiler, and virtual machine for executing your new language. Jtree also includes a simple web Tree Language Designer. https://jtree.treenotation.org/designer Designer To make your language do really interesting things, you'll want to write some code to extend your language nodes in another language that you know. Jtree lets you create new languages using just Tree Notation, Tree Notation + TypeScript, or Tree Notation + Javascript. Tree Notation and Tree Languages can be built with any language, however, not just TypeScript and Javascript. We are looking for volunteers to build libraries/sdks in other host languages. # Using Jtree ## Quick start - Open https://gitpod.io/#https://github.com/breck7/jtree - Run: code npm install -g ts-node npm install . npm run test Jtree currently includes over 10 compiled projects (aka "products") and more than a dozen Tree Languages. # Basic TreeNode library for npm projects: code const {TreeNode} = require("jtree/products/TreeNode.js") const tree = new TreeNode("hello world") console.log(tree.asString) # Basic TreeNode library + Grammar Language for the browser: code <script src="../../products/Utils.browser.js"></script> <script src="../../products/TreeNode.browser.js"></script> <script src="../../products/GrammarLanguage.browser.js"></script> ## jtree "sandbox" web app for exploring base Tree Notation code npm install . npm run local open http://localhost:3333/ ## jtree "Designer" web app for building new Tree Languages code npm install . npm run local open http://localhost:3333/designer ## TreeComponentFramework for building web apps This is a web framework still in the research stage. Whether it evolves into a serious line of effort is unknown. ## Sample Languages More than 12 example Tree Languages for helping with various tasks. See the `langs/` folder. ## Build Tools If you look at the source, you will also see a set of build tools (such as Builder and TypeScriptRewriter). These are currently undocumented and not recommended for external use. ## Building all tools and running tests code npm run build npm test # Monorepo Jtree is a monorepo. With on average over 1 major version released each month for the past 2.5 years, it would take a lot of overhead to constantly be updating 10+ different repositories and modules every month. Once we're more confident in the theory and best practices, it might make sense to break this repo into independent modules. That being said, we despise unnecessary dependencies as much as anyone. If anyone wants to create some automated submodules built from the projects in this monorepo, to allow for consuming of a smaller subset of the code and dependencies in this module, feel free to do so. ## Visualization of the code base https://mango-dune-07a8b7110.1.azurestaticapps.net/?repo=breck7%2Fjtree Visualization image images/diagram.svg # Development Status All breaking changes are mentioned in the releaseNotes. We follow semantic versioning, so breaking changes should not happen if you stay on the same major version. link releaseNotes.html releaseNotes # Tree Notation Libraries in Other Languages If you build a Tree Notation library/SDK in another language, let us know and we'll add a link. If you are working on a Tree Notation library in a new host language, feel free to post an issue or ask for help in the TreeNotation subreddit. https://reddit.com/r/treenotation subreddit ## How to bump versions code npm run updateVersion NEW_NUMBER # Alternatives Considered This is the first Tree Notation library in existence, so there were no alternative implementations. Note and Space were predecessors to Tree Notation. If a better alternative low level notation to Tree Notation is possible, it has yet to be discovered. All that said, the important part of this repo is not the code but the design patterns. Tree Notation is very simple, and you can implement the patterns contained here in your own code without using this library. In fact, that is often the best way to use Tree Notation! ## Editing in Sublime Text It is helpful to set `"goto_anything_exclude_gitignore": true` to ignore files in gitignore. Read more here. https://breckyunits.com/code/my-sublime-setttings.html here #❤️ Public Domain❤️ import footer.scroll
"FYI The only DSL with a readme is the poop one."
At the least we should have something like: knexjs or sizzle(cheerio).
Beyond that, given that Tree Notation has some unique geometric properties, there might be a new language that can take advantage of those.
Beyond that, there may be another type of query language for Grammar backed languages.
[] Integrate checkLinks.sh into CI.
[] Setup smarter 404 redirects if possible
[] create 404 jekyl pages
Might require having the diff work done first.
Request from X. Have unit types, like "40ml" and allow pattern matching at the cell level. So you could have unnamed, any order argument functions.
[] table
[] comment
[] compile to HTML or markdown
[] ship as a browser product.
[] provide instructions for using in browser
[] ship with ohayo
How does is this project different from a intermediate representation like JVM byte code or .net IR?
The FAQ for this project says treenotation is like a base level notation which allows for some cross-platform tooling and interoperability which are qualities of intermediate representations.
Currently there is 1 global keyword map per grammar. If I want to use the same name for 2 different keywords there is no way to do it.
# program:
plot.scatter
x Day
person.chromosome
x 231
# grammar:
keyword x
Currently there is no way to define 2 different keywords named "x". Should I allow this?
The better solution might be grammar switching.
As a rustacean pointed out, it doesn't look like there's a formal spec in this repo anymore. While there are fragments of them in the papers and on pages like the 2 below, it may be helpful to have a formal spec for implementors in other languages to use.
#1
https://github.com/breck7/space/blob/master/spec.txt
I don't think we should, but it does potentially make Tree programs play nicer with spreadsheets. We should document why this is a good or bad idea.
It is nice to have the mutable methods in one place, but not sure if there is a better way to do this.
The current pattern is ugly and we should have better typing for things like forEach.
Looks like you need 1500 reputation to add a "treenotation" tag. I might have that in one of my accounts but need to check.
Add "toWebForm" method and do an RFC explaining the idea.
Perhaps add "header" flag to nodeType definitions in grammar language.
reported from suhail
Many reports find the current homepage confusing. Let's eventually get a new one going.
Potential models: https://guild.ai/ http://tree-sitter.github.io/tree-sitter/
With color highlighting we don't need that anymore.
The JSON example might be misleading. Let's clean up the simple examples in the readme.
I typed out the following JSON in the sandbox:
{
"foo bar": "foo"
}
Which converted to the following tree:
foo bar foo
However, that tree converts back to the following JSON:
{
"foo": "bar foo"
}
This JSON differs from the input.
I don't know if this only an issue with whitespaces but there seems to be some inconsistency or incompatibility when mapping between the two.
Work for this is partially done at http://lime.treenotation.org/
I am wondering how much use pytree
is in comparison to jtree
... jtree
obviously looks a lot more complete for CLI use.
I want to begin playing with tree notation. Is the pytree
experience feasible or should I go for a good starting experience with jtree
?
Something that correctly encodes all (most) of JSON.
Add some demo API example languages. Do a "Tree Notation as the NextGen API Language" RFC post.
Demo from 2014:
https://www.youtube.com/watch?v=DV4Nv23bBwQ&t=1s
For tiny DSLs, what if we had grammar up top, data below.
Example:
grammar
productsNode
root
inScope productNode
anyCell
folderCell
enum treeComponentFramework/sweepercraft/ treeComponentFramework
targetCell
enum browser nodejs
productNode
inScope idNode outputFileNameNode folderNode filesNode targetNode exportClassesNode
idNode
cells anyCell
outputFileNameNode
cells anyCell
folderNode
cells folderCell
filesNode
catchAllCellType anyCell
targetNode
cells targetCell
exportClassesNode
cells anyCell anyCell anyCell
data
product
id SweeperCraft
outputFileName SweeperCraft.browser.js
folder treeComponentFramework/sweepercraft/
files treeComponentFramework/sweepercraft/SweeperCraft.ts
target browser
product
target browser
id TreeComponentFramework.Browser
outputFileName TreeComponentFramework.browser.js
folder treeComponentFramework
files worldWideTypes/treeNotationTypes.ts treeComponentFramework/Willow.ts treeComponentFramework/TreeComponentFramework.ts
product
target nodejs
id TreeComponentFramework.Node
outputFileName TreeComponentFramework.node.js
folder treeComponentFramework
files worldWideTypes/treeNotationTypes.ts treeComponentFramework/Willow.ts treeComponentFramework/TreeComponentFramework.ts
exportClasses AbstractTreeComponentRootNode AbstractTreeComponent AbstractCommander
Let's build a page like: http://json.org/ which lists all the implementations of libraries in the different languages. It could also help coordinate who is working on what language and what the status of each project is.
Once TreeScript is more stable let's move completely off TypeScript to TreeScript (and run stuff off that for the most part, compiling to JS/WASM later)
Here's a good model to base it on (https://home.cern/science/computing/birth-web/licensing-web)
CERN relinquishes all intellectual property rights to this code, both source and binary and permission is given to anyone to use, duplicate, modify and distribute it.
How should we provide better support for Blank Lines in the Grammar Language?
It's a common request. I feel like we should change the defaults and perhaps make blank lines not errors, and perhaps a default node type, and have Tree Language designers opt in to making them errors.
Please provide a grammar of TN in ABNF.
Redesign of the site should change the TreeNotation.org landing page to a show don't tell, with images, videos, animated gifs, demos, etc.
Should have types like 40oz 10meters 12ft etc.
https://medium.com/@Jernfrost/defining-custom-units-in-julia-and-python-513c34a4c971
How can we solve the "meta" problem of how to help others build Tree Notation libraries in different host languages?
Can we provide a universal set of test cases?
from discussion with ahmed
We need to show people the db so they can see the mountain of work and prior languages this is building on.
For SSV language
Can be some tricky dependency cycles with upgrading to newer versions of languages. Should have a design pattern perhaps where we tag a branch for the desired upgrade, or just ship a separate repo with the necessary files from products/ coupled with the upgrade code.
Perhaps use TS as a model: https://typescript-play.js.org/
From user tests:
[] speed. let's get back to instant startup. Lazy loading? Save indexes?
[] better ohayo integration with TreeBase
[] query build on treebase startup page.
[] surface 10 interesting queries? instant start. something more exciting than what we currentlty have.
[] distribution of key variables on treebase startup page?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.