Skip to content

TiLied/CSharpToJavaScript

Repository files navigation

CSharpToJavaScript

Nuget package | CLI | Website | Try it online!

This library is the "core" where all the "magic" happens for translating/converting C# into JS, using Roslyn.

It is recommended to use the CLI/dotnet tool unless you want to write the front-end by yourself. Look for the implementation in the CLI, BWA app or the simple "Hello world" example below.

The CLI/dotnet tool is a simple cli front-end that behaves more or less like the dotnet cli, tsc cli, meson.

Status

test262-parser(master): Only JS part (code is not public, yet. ES5 implemented) Total tests: 5363 | Passed: 2824 (52 %) | Failed: 2539

test262(es5 branch): Total tests: 11725 | Passed: 1272 (10 %)** | Failed: 10453

**Note: Tests run with "UseVarOverLet" option, using Jint as an engine.

Hello world

FileData file = new()
{
	SourceStr = @"Console.WriteLine(""Hello world."");"
};
file = CSTOJS.Translate(file);

Console.WriteLine(file.TranslatedStr);
  • Run a program
  • Console output should be:
console.log("Hello world.");
  • For options, look at the code or on the website.
  • To specify options (per file):
FileData file = new()
{
	OptionsForFile = new(){ Debug = true },
	...
};
...

Related Repository

About

This library translates/converts C# into JS, using Roslyn.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages