Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
FYI the end goal is plugins for IDEs, and maybe a small website with popular language syntaxis
-
@ewpratten that's just a syntax right? is it used to change the syntax of code?
-
@calmyourtities so how would this work? You make an AST from an input and language description (I second @ewpratten's suggestion, BNF is pretty much the way to go for grammar definitions) and compile that AST back into code using some other language definition?
-
@calmyourtities abstract syntax tree
Basically an abstract representation of the structure of your program in terms of nodes, which frees the thing from the structure of written syntax.
Eg. For 5 * (2 + 3)
I'd have a multiply-node at the root of the tree, inside which (i.e. children of which) are a value-node with the value 5 and an add-node, inside which are two value-nodes for 2 and 3.
The introductory example on the Wikipedia page is pretty nice
https://en.m.wikipedia.org/wiki/... -
@calmyourtities
If I was writing the same expression in lisp with its different syntax, eg. (* 5 (+ 2 3)) (operator-operand-operand instead of the usual operand-operator-operand) I just have to change my parser, the AST built stays the same so you can use a common set of tools to process it. A similar idea (intermediate representation) is what allows LLVM to compile so many languages using a common framework. -
The hard parts for this would be the standard libraries, and languages which just operate differently, e.g. Js (or actually Node) being single-threaded with async i/o which is tricky to translate to another language.
-
If you're not prepared to design the most epic and complex layers of abstraction that's not gonna be a whole lot of fun. Not the syntax part but the semantics
-
I really like the idea. But have a look at the complexity of LLVM which does a much simpler sourcecode->ir->machinecode translation rather than sourcecode->ir->sourcecode. I'm not trying to be mean or anything, I really like the idea. It's just a lot of complexity
-
Visual programming is understatement in its current position. Better work on it instead of making another syntax.
The Open Standard For Cross-Language Syntaxis
The Open Standard For Cross-Language Syntaxis