flux_compiler 0.1.0
flux_compiler: ^0.1.0 copied to clipboard
Lexer, Parser, AST, and Bytecode compiler for the Flux scripting language. Includes optimizer and source map generator.
Flux Compiler #
The official compiler for the Flux programming language.
Converts Flux source code into bytecode chunks that can be executed by the Flux VM.
Features #
- Single-Pass Compilation: Efficient compilation pipeline.
- Optimization: Basic peephole optimizations for size and speed.
- Source Maps: Generates debugging information.
- Error Reporting: Detailed compile-time error messages.
Usage #
import 'package:flux_compiler/flux_compiler.dart';
void main() {
String source = 'print("Hello Flux");';
// Lexing
final lexer = Lexer(source);
final tokens = lexer.tokenize();
// Parsing
final parser = Parser(tokens);
final ast = parser.parse();
// Compiling
final compiler = Compiler(unit: ast);
final function = compiler.endCompiler();
// function.chunk contains the bytecode
}
Contributing #
See Flux Repository.