rust/src/comp/driver/rustc.rs

53 lines
1.1 KiB
Rust
Raw Normal View History

2010-06-23 21:03:09 -07:00
// -*- rust -*-
import std._str;
import lib.llvm.llvm;
import lib.llvm.builder;
fn write_module() {
auto llmod =
llvm.LLVMModuleCreateWithNameInContext(_str.buf("rust_out"),
llvm.LLVMGetGlobalContext());
auto b = builder(llvm.LLVMCreateBuilder());
llvm.LLVMWriteBitcodeToFile(llmod, _str.buf("rust_out.bc"));
llvm.LLVMDisposeModule(llmod);
}
2010-06-23 21:03:09 -07:00
fn main(vec[str] args) -> () {
log "This is the rust 'self-hosted' compiler.";
log "The one written in rust.";
log "It does nothing yet, it's a placeholder.";
log "You want rustboot, the compiler next door.";
auto i = 0;
for (str filename in args) {
if (i > 0) {
auto br = std._io.new_buf_reader(filename);
log "opened file: " + filename;
for (u8 b in br.read()) {
log b;
}
}
i += 1;
}
// Test LLVM module-writing. Nothing interesting yet.
write_module();
2010-06-23 21:03:09 -07:00
}
//
// Local Variables:
// mode: rust
// fill-column: 78;
// indent-tabs-mode: nil
// c-basic-offset: 4
// buffer-file-coding-system: utf-8-unix
// compile-command: "make -k -C ../.. 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
// End:
//