2

The Open Standard For Cross-Language Syntaxis

Project Type
Open source idea
Summary

The Open Standard For Cross-Language Syntaxis

Description
A project to translate code - code can be written in any language and translated to another. I can write a syntax definition for any two languages, and they will be able to translate from one to another. Eg. I can write a syntax definition such as: var [var_name] [type]; [var_name] = [value]; if( [BOOLEAN_EXPR] ) { [CODE_BLOCK] } and another syntax definition: [type] [var_name] [var_name] : [value] if [BOOLEAN_EXPR]: [INDENT_CODE_BLOCK] then with my definitions, I could write code in the first definition: var myVariable int myVariable = 1 if ( myVariable > 0 ) { print("greater than 0!"); } and translate that code into the syntax of the second definition: int myVariable myVariable : 1 if myVariable > 0: print("hi") The goal of this project is to allow people the freedom of syntax and defining how they want to program a language.
Tech Stack
any for the interpreter
Comments
  • 0
    FYI the end goal is plugins for IDEs, and maybe a small website with popular language syntaxis
  • 1
    where do i sign qwq
  • 5
    Will you support brainfuck and jsfuck?
  • 0
    @alexbrooklyn if you write your own syntax definition!
  • 1
    There is already something like that. Thrift.
  • 0
    @ewpratten that's just a syntax right? is it used to change the syntax of code?
  • 0
    @-ANGRY-CLIENT- looks ok but not ideal.
  • 0
    @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?
  • 0
  • 0
    @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/...
  • 0
    @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.
  • 0
    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.
  • 0
    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
  • 0
    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
  • 0
    Visual programming is understatement in its current position. Better work on it instead of making another syntax.
Add Comment