sebastien / tlang Goto Github PK
View Code? Open in Web Editor NEWExperimental language using trees as the primary data structure
Experimental language using trees as the primary data structure
== TLang -- A Tree Processing Language The T Language is a language for creating, querying and transforming trees. TLang is primarily intended as a DSL to write software that works primarily with trees. TLang can be usef to create parsers, compilers, transpilers, analyzers, but also build systems, caching layers, database systems and basically and application which data model can be represented as a tree. TLangs main features are: - Main syntax based on S-Expr - Embedded query language - Extensible optimizing transpiler to native language - S-Expr, XML & JSON tree import/export - Easy interoparability with many languages Goals ===== High-level goals: - Support **meta-programming and macro-systems**: because TLang is all about transforming trees and interfacing with text formats, it is very well suited to meta-programming and creating macro systems on top of existing languages. - Provide an **foundation for extensible compiler implementation**: compilers are essentially a set of tree transformation passes applied one after the other. TLang aims at abstracting away the definition of these passes and allowing for efficient combination and composition so that parsing and compilation can go as fast as possible. - Support **high-performance incremental tree transformation**: TLang programs should work with a full snapshot of a tree, but also with increments (patches/deltas) that are translated into effects. This is an important feature to support interactive/live programming environments and efficient compiler implementation. - Expand **beyond compilers**: while compilers and analyzers are obvious applications, TLang could be used to implement any system that maintains data as a tree or tree-graph (using node reference in attributes). Live programming environments, databases, user interface renderers or expert systems might benefit from TLang. - Be **language agnostic**: although TLang is implemented in Python, it is intended to work with any general purpose programming language by implementing a backend that supports it. TLang is implemented as a *set of mini-languages* combined together. Each language is designed to be relatively easy to learn by taking its roots in established formalism (EBNF grammars, S-Expressions or XPath/CSS selectors), and offers a canonical representation as an S-Expression if you don't like the syntactic sugar offered by the mini language. It is good to note that S-Expression are convertible to JSON and XML, and that JSON and XML can also be converted to S-Expressions, given some minimal conventions. Mini languages ============== TLang is a composition of simple mini-languages with canonical representations: - The [Tree language](docs/tree.txto) that defines a text-based representation of trees using S-Expr, XML and JSON. - The [Expression language](docs/expr.txto) that defines a text-based representation of basic computation using a Lisp-ish dialect. - The [Query language](docs/query.txto) that defines how to retrieve values and nodes from a tree. - The [Schema language](docs/schema.txto) that defines a representation for expressing constraints and rules to be applied on a tree. - The [Transform language](docs/transform.txto) that defines how trees can be transformed into other trees or other data structures. - The [Format language](docs/format.txto) that defines a mapping between text representation and tree representation. These mini language share consistent design features and are composed together. Under the hood, they all produce TLang Tree structures and have associated TLang Schemas. Examples ======== - A mini language transpiler - A build system - A type system - A database engine - A document formatting system - An accounting system Development =========== Related work ============ Related projects: - [TXL](http://txl.ca) ― The Txl Programming Language, " Source Transformation by Example" - [Eclipse XText](https://www.eclipse.org/Xtext/) ― "Language Engineering For Everyone!" - [Stratego](http://strategoxt.org/)/[Spoofax](http://www.metaborg.org/en/latest/) ― "… a platform for developing textual (domain-specific) programming languages" - [Rascal-MPL](https://www.rascal-mpl.org/#_Metrics) ― "… integrating source code analysis, transformation, and generation primitives on the language level." (see also [ASF+SDF](http://www.meta-environment.org/)) - [Fast](https://rise4fun.com/Fast) ― Compared to the above projects, TLang focuses more on the notion of tree-tree transformation as oppposed to text-tree-text transformation. It is also, at its core, a language-agnostic tool to write efficient incremental programs that transform trees. Loosely related projects: - [Treepace](https://github.com/sulir/treepace), a Python library to create and query trees, featuring a compact and expressive syntax. Treespace gets many things right, and has informed the design of the tree syntax. - [OHM](https://github.com/harc/ohm), the successor of OMeta, a JavaScript implementation of a language to generate parsers. It has a really nice [online interactive editor](https://ohmlang.github.io/editor/) that shows how live visual feedback helps building a grammar. - [Zephyr ASDL](https://www.cs.princeton.edu/research/techreps/TR-554-97), a language to describe ASTS. It is notably [used in Python](https://github.com/python/cpython/blob/master/Parser/Python.asdl). The Oil Shell blog has [two](https://www.oilshell.org/blog/2016/12/11.html) [articles](https://www.oilshell.org/blog/2016/12/16.html) on the subject. - [Gremlin](https://www.slideshare.net/slidarko/gremlin-a-graphbased-programming-language-3876581), a graph-based programming language. [TLang](https://bitbucket.org/sebastien/tlang) is implemented in Python 3 and is maintained by [Sébastien Pierre](https://sebastienpierre.nz). It is licensed under the Revised BSD License. Misc links: - http://www.jclark.com/dsssl/ - https://www.youtube.com/watch?v=OyfBQmvr2Hc - https://github.com/ollef/sixten/blob/master/docs/QueryCompilerDriver.md # EOF - vim: ts=2 sw=2 et syn=texto
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.