MetaForge Compiler (MFC) is the native compiler for the MetaForge programming language, designed to provide efficient and seamless compilation for your MetaForge projects. It supports cross-platform compilation and offers various options to customize the output.
- Native compilation for the MetaForge language.
- Support for cross-platform targets (e.g., Windows, Linux, MacOS and FreeBSD system like Ps* system).
- Adjustable architecture options (e.g., x64, ARM).
- Verbose output for debugging and monitoring the compilation process.
Ensure you have Python installed on your system (Python 3.13 or higher is recommended).
-
Clone the repository:
git clone https://github.com/seregonwar/MetaForge-Compiler.git cd MetaForge-Compiler
-
Install the required Python dependencies:
pip install -r requirements.txt
To compile a MetaForge source file, use the following command structure:
python src/compile_metaforge.py <source_file> -o <output_file> [options]
The following example compiles a MetaForge file named hello_world.mf
:
python src/compile_metaforge.py examples/hello_world.mf -o build/hello_world.exe --platform windows --arch x64 -v
<source_file>
: Path to the MetaForge source file to compile (e.g.,examples/hello_world.mf
).-o <output_file>
: Specifies the output file path (e.g.,build/hello_world.exe
).--platform
: Sets the target platform (windows
,linux
, etc.).--arch
: Specifies the architecture (x64
,x86
,arm
).-v
: Enables verbose output for additional compilation details.
Run the following command to view all available options:
python src/compile_metaforge.py --help
MetaForge provides three compilation methods, each tailored to specific project needs.
- Description: Uses MetaForge’s native compiler to directly convert
.mf
files into.exe
executables. - Features:
- Direct compilation without intermediaries.
- Pros: Maximum stability, high performance, and secure output.
- Use Case: Best suited for standalone programs and native applications.
- Description: Utilizes the GCC compiler through a multi-step process:
- Converts the
.mf
file into an intermediate C file. - Compiles the C file into libraries (DLL) or object files (Obj).
- Optionally links the object files to produce an executable.
- Converts the
- Features:
- Pros: Ideal for creating support libraries or reusable components.
- Cons: Not recommended for complete programs due to reduced stability and security compared to native compilation.
- Use Case: Useful for building add-ons or ensuring interoperability with C-based projects.
- Description: Similar to the GCC method but uses Python as the intermediary language.
- Python translates the
.mf
file into executable or web-compatible code, with some performance trade-offs. - Since Python is a higher-level language than MetaForge and C, this results in a performance drop (up to 70% of MetaForge’s potential).
- Python translates the
- Features:
- Pros: Essential for web applications and compatible with technologies such as WebAssembly.
- Cons: Higher overhead and lower performance compared to other methods.
- Use Case: Designed to enable MetaForge in web environments and applications requiring online integration.
MetaForge-Compiler/
├── examples/
│ └── hello_world.mf # Example MetaForge program
├── src/
│ └── compile_metaforge.py # Compiler script
├── build/ # Output directory (generated after compilation)
├── requirements.txt # Python dependencies
└── readme.md # Documentation
Contributions are welcome! If you'd like to improve the compiler or add new features, feel free to fork the repository and submit a pull request.
This project is licensed under the MIT License. For commercial use of the MetaForge language, consult the license terms included in the MetaForge specification.