WindowsBrainfuckCompiler
所属分类:人工智能/神经网络/深度学习
开发工具:C#
文件大小:0KB
下载次数:0
上传日期:2020-08-20 20:53:02
上 传 者:
sh-1993
说明: 将脑操程序转换为windows可执行文件,
(Turns brainfuck programs into windows executables,)
文件列表:
BrainfuckCompiler.csproj (170, 2020-08-20)
BuildProcess.cs (5061, 2020-08-20)
BuildProperties.cs (1688, 2020-08-20)
LICENSE (1070, 2020-08-20)
OptimizeProcess.cs (3323, 2020-08-20)
Program.cs (377, 2020-08-20)
Properties/ (0, 2020-08-20)
Properties/launchSettings.json (126, 2020-08-20)
bin/ (0, 2020-08-20)
bin/Debug/ (0, 2020-08-20)
bin/Debug/netcoreapp3.0/ (0, 2020-08-20)
bin/Debug/netcoreapp3.0/BrainfuckCompiler.deps.json (421, 2020-08-20)
bin/Debug/netcoreapp3.0/BrainfuckCompiler.dll (12288, 2020-08-20)
bin/Debug/netcoreapp3.0/BrainfuckCompiler.exe (159744, 2020-08-20)
bin/Debug/netcoreapp3.0/BrainfuckCompiler.pdb (4068, 2020-08-20)
bin/Debug/netcoreapp3.0/BrainfuckCompiler.runtimeconfig.dev.json (165, 2020-08-20)
bin/Debug/netcoreapp3.0/BrainfuckCompiler.runtimeconfig.json (146, 2020-08-20)
bin/Debug/netcoreapp3.0/build.bat (55, 2020-08-20)
obj/ (0, 2020-08-20)
obj/BrainfuckCompiler.csproj.nuget.cache (145, 2020-08-20)
obj/BrainfuckCompiler.csproj.nuget.dgspec.json (1945, 2020-08-20)
obj/BrainfuckCompiler.csproj.nuget.g.props (1103, 2020-08-20)
obj/BrainfuckCompiler.csproj.nuget.g.targets (289, 2020-08-20)
obj/Debug/ (0, 2020-08-20)
obj/Debug/netcoreapp3.0/ (0, 2020-08-20)
obj/Debug/netcoreapp3.0/BrainfuckCompiler.AssemblyInfo.cs (1001, 2020-08-20)
obj/Debug/netcoreapp3.0/BrainfuckCompiler.AssemblyInfoInputs.cache (41, 2020-08-20)
obj/Debug/netcoreapp3.0/BrainfuckCompiler.assets.cache (139, 2020-08-20)
obj/Debug/netcoreapp3.0/BrainfuckCompiler.csproj.CoreCompileInputs.cache (41, 2020-08-20)
obj/Debug/netcoreapp3.0/BrainfuckCompiler.csproj.FileListAbsolute.txt (2884, 2020-08-20)
obj/Debug/netcoreapp3.0/BrainfuckCompiler.csprojAssemblyReference.cache (109055, 2020-08-20)
obj/Debug/netcoreapp3.0/BrainfuckCompiler.dll (12288, 2020-08-20)
obj/Debug/netcoreapp3.0/BrainfuckCompiler.exe (159744, 2020-08-20)
obj/Debug/netcoreapp3.0/BrainfuckCompiler.genruntimeconfig.cache (41, 2020-08-20)
obj/Debug/netcoreapp3.0/BrainfuckCompiler.pdb (4068, 2020-08-20)
obj/Release/ (0, 2020-08-20)
obj/Release/netcoreapp3.0/ (0, 2020-08-20)
... ...
# BrainfuckCompiler
Turns brainfuck programs into windows executables.
# Features
The Compiler supports:
Dead Code Removal
Consecutive Instruction Compression
Known Construct Replacement
File and Console IO
# How it works
This compiler works by transpiling all your bf code into C. After that it uses a windows C compiler to turn that C code into an windows executable.
# Requirments
This program requires the [mingw-w64](https://mingw-w64.org/doku.php/download) C compiler.
This program also requires the PATH environment variable to reference the bin folder of your mingw-w64 installation.
# How to use the compiler
The executable is in the [/bin/Debug/netcoreapp3.0](/bin/Debug/netcoreapp3.0) folder. The program is designed to be used from the command line.
To compile a program use 'BrainfuckCompiler
'. This will create an executable with the same name that will also be runnable from the command line.
If using the build flag "-fio" the IO files will be named \_input.txt and \_output.txt the output file will be created at runtime if it is not precreated but the input file will not, so it needs to be created before runtime.
# Build Flags
-cio: Uses console IO rather than file IO (this flag is redundant as it is set by default)
-fio: Uses file IO rather than console IO
-s: Keeps the C source file instead of deleting it
# Optimizations
## Consecutive Instruction Compression:
This compiler is capable of combining several identical instructions into one instruction.
Previously a sequence of instructions like:
`>>>>>`
Would be transpiled into:
```
i++;
i++;
i++;
i++;
i++;
```
However the compiler will optimize this to:
`i+=5;`
## Dead Code Removal:
The compiler will remove code that is know to be dead.
Loops at the begining of a program:
```[this wont be compiled!.,.+--+.<>>>><<][Neither will this!>><+-]```
A loop following another loop:
```+[this will be compiled][this won't]```
## Known Construct Replacement
Several common constructs are used in brainfuck such as: `[-] and [+]`
These two constructs always set the cell to zero so instead of using a loop to do it we can directly set the cell to zero.
Empty loops (`[]`) are entirly eliminated from the program whether or not they run.
# Issues
0: Going out of bounds on the tape is completly undefined. The program will still compile, but unpredictable and unexpected behaivour is fully expected.
1: 'gcc' is not recognized as an internal or external command, operable program or batch file.
Fix: Please create a reference to the bin folder of your mingw-w64 installation in the PATH environment variable.
近期下载者:
相关文件:
收藏者: