You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Program.cs
+99-30Lines changed: 99 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -2,14 +2,25 @@
2
2
usingSystem.CodeDom.Compiler;
3
3
usingMicrosoft.CSharp;
4
4
usingSystem.IO;
5
+
usingSystem.Runtime.Serialization.Formatters;
6
+
usingSystem.Linq;
7
+
usingSystem.Collections.Generic;
8
+
usingSystem.Runtime.Remoting.Messaging;
9
+
5
10
namespaceBrainFexec
6
11
{
7
12
internalclassProgram
8
13
{
9
14
privatestaticstringcode="",fn="";
10
15
staticvoidMain(string[]args)
11
16
{
12
-
switch(args.Length)
17
+
intlen=args.Length;
18
+
boolopt=false;
19
+
if(args.ToList().Exists(x =>x=="-o")){
20
+
len--;
21
+
opt=true;
22
+
}
23
+
switch(len)
13
24
{
14
25
case1:
15
26
{
@@ -27,7 +38,7 @@ static void Main(string[] args)
27
38
}
28
39
default:
29
40
{
30
-
Console.WriteLine("Usage:\nBrainFExec <input> [output]\nBrainFuck to EXE compiler, compiles BrainFuck into a Windows executable.\ninput: Input file name\nOutput: Output file name, if this argument is not passed and the input file name is 'a.bf', output file name will be 'a.exe'.");
41
+
Console.WriteLine("Usage:\nBrainFExec <input> [output] [-o]\nBrainFuck to EXE compiler, compiles BrainFuck into a Windows executable.\ninput: Input file name\noutput: Output file name, if this argument is not passed and the input file name is 'a.bf', output file name will be 'a.exe'.\n-o: Optimize");
Copy file name to clipboardExpand all lines: README.md
+9-2Lines changed: 9 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,14 +2,21 @@
2
2
BrainFExec is a [BrainFuck](https://esolangs.org/wiki/BrainFuck) compiler to Windows executable in C#.
3
3
## Usage
4
4
```commandline
5
-
BrainFExec <input> [output]
5
+
BrainFExec <input> [output] [-o]
6
6
```
7
7
Compiles BrainFuck code into a Windows executable:
8
8
* input: Input BrainFuck file name
9
9
* output: Output BrainFuck file name
10
+
* -o: Optimize
10
11
11
12
If `output` is not passed, BrainFExec automatically decides the file name: For example, if the input BrainFuck filename is `a.bf`, it sets the output file to `a.exe`.
12
13
## How it works
13
14
It first converts BrainFuck to C#, then uses dynamic compiling to compile the resulting C# program to an executable.
0 commit comments