Feature Request: Make WML a Compiled Language
Summary
Transform World Modeling Language (WML) into a compiled language to improve performance, error detection, and deployment efficiency.
Background
Currently, WML operates as an interpreted language, which presents several limitations including slower execution speeds, runtime errors, and increased resource consumption. Compiling WML would address these issues, providing a more robust and efficient tool for developers.
Expected Benefits
- Performance Improvement: Compiled code generally runs faster than interpreted code due to optimizations made during the compilation process.
- Enhanced Error Detection: Compile-time error checking can catch issues before runtime, reducing the chances of runtime failures.
- Deployment Efficiency: Compiled binaries are easier to distribute and deploy, as they do not require the end user to have an interpreter installed.
Detailed Description
Steps to Implement
-
Design a Compiler:
- Develop a compiler that can translate WML scripts into machine code or an intermediate bytecode.
- Ensure the compiler performs optimizations to enhance the performance of the generated code.
-
Syntax and Semantic Analysis:
- Implement robust syntax and semantic analysis to ensure code correctness and provide informative error messages.
-
Intermediate Representation (IR):
- Introduce an intermediate representation to simplify optimization and code generation processes.
- IR can be either platform-independent bytecode or an abstract syntax tree (AST) representation.
-
Code Generation:
- Develop a backend for the compiler to generate machine-specific code or bytecode from the IR.
- Ensure compatibility with multiple operating systems and architectures.
-
Linking and Packaging:
- Create a linker to combine compiled modules into a single executable or library.
- Provide tools for packaging and distributing the compiled WML applications.
Example Workflow
- Write WML Code: Developers write their WML scripts as usual.
- Compile Code: Use the WML compiler to compile the script into an executable or bytecode.
wml compile my_script.wml -o my_program.wmlb
- Run Program: Execute the compiled binary or bytecode.
Potential Challenges
- Development Resources: Building a compiler from scratch requires significant time and expertise.
Environment Details
- Current Version: WML 0.1.0-alpha
- Operating Systems: Linux
- Dependencies: None
Priority
- Priority Level: High
- Impact: Significant improvement in performance and reliability for WML applications.
Additional Notes
- Consider providing extensive documentation and tutorials to help users transition to the compiled version of WML.