Git Product home page Git Product logo

merge-lang's Introduction

Archiving

I thought this was a good idea but now I see It's just doing a thing that just exists. There is no such thing like IPC automation because writing a merge bridge is no different than writing a IPC call function.

Maybe added Type-safety features to IPC's could be a programming paradigm but they exist too! Reinventing makes no sense for sure! Also It had to be "merge" not "merge-lang" because It's too domain specific, pretty verbose and unreadable.

One of the reasons I saw this as a good project was:

  1. Inexperienced users that replied to me positively on various number of social media platforms.
  2. People like their ideas. I didn't want to criticize (I guess)
  3. I needed an idea for a competition. Even (probably) I saw some ambiguities in my project.

Table of Contents

  1. Merge
    1. TLDR
    2. Manifest
      1. merge-lang
      2. Inference
      3. File Structure
      4. Compile
      5. Scheduling Execution
      6. Runtime
    3. Package Manager
  2. API

Merge

NOTE: Any of the features are not implemented yet. Itā€™s planned to do so.

TLDR

New approach to programming languages with generic multilang communication system, allowing you code with multiple programming languages in a project with a modern automated interface.

Manifest

Developing a project using multiple programming languages can easily become a complex task. although there are some Simpler solutions to this problem. They generally lack relaibility, performance, stability etc.

This is a common situation that happens to all of us. For example:

X programming language has a library/framework that I cannot use with Y programming language.

There are some solutions to this problem like:

  • Transpilers: Automated X lang to Y lang converters. (just like .png to .jpeg but more complex)
  • Rewrite: Rewriting the program in X lang. (e.g fish shell was written in C++, now it is getting rewritten in rust)
  • FFIā€™s (Foreign Function Interface)
  • ABIā€™s (Application Binary interface)
  • Language Communication Protocols (e.g IPC, Shared Memory, Server)
  • Wrappers: Custom libraries that wrap around the native language using Language Communication Protocols.

One of the few solutionā€™s that I mentioned above are hard to implement in general. Others are:

  • Overall Transpilers: Could generate erroneous output (defective transpilers)
  • Rewrites: Consumes a lot of time & effort. Because of the human factor.

Because of these strenuous ways of implementing multi-lang interfaces We introdoce you merge-lang

merge-lang

A generic meta programming language that automates the process of combining programming languages in a project

Merge takes another approach than the other solutions I mentioned.

  1. Initial Algorithm

    • Inference (understands the data communication points: more on that in the next section)
    • Constructing the file structure (splitting code to itā€™s pieces by the fewest whispers1)
    • Compiling
    • Scheduling Execution
    • Runtime

Inference

This is probably the most complex part of merge-lang. (Also the most innovative way) Look at the following example:

    #[python]
    use *;

    fn main() {
        python::print("hello, world");

        #[python]
        {
            a = "world"
            print(f"hello {a}")
        }

        python!{
            a = "hello"
            print(f"{a} world!")
            import a from b
            a.hello()

            def python_fn():
                return 5
        };

        let val_py = python!(python_fn());
        let val_py = python::python_fn();

        println!("from rust: {val_py}");
    }

File Structure

Writing our own compiler for all languages that we support would be imposible. Because of this merge compiler will split your code into pieces that external languages can understand.

With this tecnique you can integrate any programming language to merge-lang using Itā€™s API

Compile

Merge language compiles to rust code, then LLVM IR and ASM.

Scheduling Execution

The dependencies need to evaluate in a way that every language can get the value they need at the runtime in a linear way. (Just like single vs multi-thread apps)

Think this as a major surgery with you (the doctor) and Mr. Clumsy (the nurse)

  1. If Mr. Clumsy gives you a cleaver instead of a lancet, the patientā€™d probably die. So Mr. Clumsy must give you the right tool to do the surgery. But It doesnā€™t end here.
  2. If Mr. Clumsyā€™d give you a lancet one minute later (or before) than the time you need it. The patientā€™d die again because of haemorrhage. So timing is a must too!

And donā€™t forget that we made a preconception by saying that Mr. Clumsy will give us a thing.

Runtime

Itā€™s wanted to see a nice execution sequience between languages that you use.

Package Manager

merge package manager is pending right now.

API

Merge-lang introduces an API to be able to use more and more languages with it.

Footnotes

1 data transmissions done between programming languages.

merge-lang's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

merge-lang's Issues

Presentation

Merge Programming Language

A programming language that automates IPC communications across multiple languages in a fast, cross-platform and simple way.

There are a lot of programming languages out there and What's the reason to create a new one? (is it worth the effort?)

Why Merge Programming Language?

Across Multiple Programming Languages

Merge is not only a "programming language" but a meta programming language.

Merge sits on top of other language like python, c, rust, javascript (etc.) and manages the IPC communications done between them.

Merge would be a traffic police at the time. There are chaos and commotion everywhere which needs to get fixed immediately so you put someone to organize this moil.

So when you want to pelt a variable from python to rust, you will just kindly say it to the compiler and It will send the variable to the target language (so you can use it peacefully)

Performant

Merge tries to optimize for the best it could. A Brief List of Optimizations may be:

  • Ignoring unused bridges (the data communication pipes to whisper to each other) (inferred from variable)
  • Chunking (minimalisation of bridge number, similar to async but in software)

Simple

Merge uses the simplest and the most unambiguous way of bridging between languages.

  • Here is the bridge in Merge (This one sends and recieves no variables):

    [!NOTE]
    You can ommit the [] prefix when no variables are recieved.
    Or you can ommit the -> [] postfix when there is no variable to send.
    So all of the following representations are equal

    [] -> [] # 
    -> []    # `[]`      ommitted
    []         # `-> []` ommitted

Why Rust Programming Language?

Easy Documentation

Package Management

Modern

Fast

Safe

How Does It Work?

Tokenizer

Parser

Build

Runtime

What Are The Pros And Cons?

Comment literal

Comments

TLDR

Looking for a concise way to implement comments.

I think...

My initial idea is to use # as single-line comment:

[pour] -> [scoop] # means: [var_sending_to_python] -> [var_pulling_from_python]
python! {
   print("[Python]:", scoop)
   var_pulling_from_python = 10
}

Note

I don't think merge-lang includes anything that'll make multi-line comment crucial

Purpose of this thread

  • Should merge use comments?
    • if yes, What literal should merge use? (;, //, --, <!--, /* */, --[ ], <!-- -->)
    • if no, Why?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.