GithubHelp home page GithubHelp logo

rogeralsing / projectexodus Goto Github PK

View Code? Open in Web Editor NEW
75.0 12.0 15.0 180 KB

Transpiler from C# to Kotlin.

License: Apache License 2.0

C# 100.00%
csharp roslyn roslyn-workspace kotlin transpiler

projectexodus's Introduction

ProjectExodus

Transpiler from C# to Kotlin.

Very early pre alpha

Demo:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Example
    {
        public void Main()
        {
            var i = 1.ToString();
            var res = Console.ReadLine();
            Console.WriteLine("You wrote " + res);
        }

        public void Conditionals()
        {
            var x = 1 > 2 ? "a" : "b";
        }
        public string Arrays(string[] strings)
        {
            if (strings == null)
            {
                return "null";
            }
            var x = "";
            foreach (var s in strings)
            {
                x += "," + s;
            }
            return x;
        }

        public void Linq()
        {
            int[] ints = {1, 2, 3, 4, 5, 6, 7, 8};
            var big = ints.Where(i => i > 4).Select(i => i*2).ToList();
        }

        public void Delegates()
        {
            Action<int, string> del = (a, b) =>
            {
                Console.WriteLine("{0} {1}", a, b);
            };
            Func<int, string> del2 = a => "hello" + a;
            InvokeIt(del);
        }

        private void InvokeIt(Action<int, string> del)
        {
            del(1, "hello");
        }
    }
}

Gets transpiled into

package consoleapplication3

class Example {
    fun main () : Unit {
        var i : String = 1.toString()
        var res : String = readLine()
        println("You wrote " + res)
    }
    fun conditionals () : Unit {
        var x : String = if (1 > 2) "a" else "b"
    }
    fun arrays (strings : Array<String>) : String {
        if (strings == null) {
            return "null"
        }
        var x : String = ""
        for(s in strings) {
            x += "," + s
        }
        return x
    }
    fun linq () : Unit {
        var ints : Array<Int> = arrayOf(1, 2, 3, 4, 5, 6, 7, 8)
        var big : List<Int> = ints.filter{it > 4}.map{it * 2}.toList()
    }
    fun delegates () : Unit {
        var del : (Int, String) -> Unit = {a, b ->
            println("{0} {1}", a, b)
        }

        var del2 : (Int) -> String = {a -> "hello" + a}
        invokeIt(del)
    }
    fun invokeIt (del : (Int, String) -> Unit) : Unit {
        del(1, "hello")
    }
}

projectexodus's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

projectexodus's Issues

Problem with ConsoleApp4.sln!

I hope this message finds you well. I wanted to reach out because I've been trying to run your project, but I've been encountering some difficulties. Specifically, I noticed that there is a reference to "ConsoleApp4.sln" in the code, but that file doesn't seem to exist. I tried changing the reference to "CsToKotlinTranspiler.sln", but the project still doesn't work.
I've tried a number of different things to get the project running, but so far, I haven't had any luck. I was wondering if you might be able to offer some assistance or advice on how to resolve this issue? I'm not sure if there are any additional dependencies or configuration steps required that I might have missed.
Thank you for your hard work on this project, and I appreciate any help or guidance you can offer.

Best regards,

Lawrance

Output Kotlin files in given directory

Currently, the transpiler just outputs to std out, this should be changed so that users can pass a directory path so the transpiler can output KT files in the given output directory

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.