Linux | Windows |
---|---|
ecsc
is an Enhanced C# compiler that uses Flame as its back-end. It can be used to compile both C# and EC# source code files, and ships with the following features:
- EC#'s lexical macro processor (LeMP)
- EC# language extensions, such as the
using
cast. - Aggressive ahead-of-time compiler optimizations
Caveat: ecsc
is still a work-in-progress. It does not support a number of C# language features that everyone takes for granted nowadays, like nullable value types, lambdas and type argument inference. Furthermore, it can at times get the C# semantics wrong. Feel free to open an issue (or a pull request!) if you run into an issue like this.
First, clone the ecsc
repository, and navigate to the ecsc
folder.
git clone https://github.com/jonathanvdc/ecsc
cd ecsc
Next, update the NuGet packages, and compile the ecsc
solution.
Visual Studio users should be able to open src/ecsc.sln
, switch to 'Release' mode, and hit 'Build Solution'.
If you'd rather use the command-line, that's
nuget restore src/ecsc.sln
msbuild /p:Configuration=Release src/ecsc.sln
You should be all set now. You may also want to add ecsc
to your PATH
environment variable, but I'll leave that up to you.
ecsc
should be pretty straightforward to use. Once you've installed ecsc
and added it to your PATH
environment variable, you can compile files like so:
ecsc code.cs ecs-code.ecs -platform clr
Note the -platform clr
option, which instructs ecsc
to generate code for the CLR. This is almost always what you want. Also, source files must be specified first, before any other option. If you want to specify source files later on, you must use the -source
option.
ecsc -platform clr -source code.cs ecs-code.ecs
By default, ecsc
will put your output file(s) in a folder called bin
. If you want them to end up elsewhere, use the -o
option.
ecsc code.cs ecs-code.ecs -platform clr -o a.exe