mirror of
https://github.com/azur1s/bobbylisp.git
synced 2024-10-16 02:37:40 -05:00
misc fix
This commit is contained in:
parent
873241ad94
commit
a8e6dad433
1
Makefile
1
Makefile
|
@ -6,5 +6,6 @@ build-debug:
|
|||
|
||||
build-lib:
|
||||
@echo "Building lib..."
|
||||
rm -rf /usr/include/hazure/
|
||||
cp ./lib/. /usr/include/hazure/ -r
|
||||
@echo "Building lib... done"
|
|
@ -39,6 +39,12 @@ Note: Everything in this project can be changed at anytime! (I'm still finding o
|
|||
Lowerer(?) produce HIR
|
||||
│ crates/hir
|
||||
│
|
||||
Type Checker (TODO)
|
||||
│ │
|
||||
│ ╰ Fail -> Print error -> Exit
|
||||
Pass
|
||||
│
|
||||
│
|
||||
Diagnostic(Lowering)
|
||||
│ │ crates/diagnostic
|
||||
│ ╰ Fail -> Print error -> Exit
|
||||
|
|
|
@ -65,8 +65,10 @@ impl Codegen {
|
|||
match name.as_str() {
|
||||
"write" => { format!("hazure_write({}){}\n", self.gen_ir(&args[0], false), semicolon!()) },
|
||||
"read" => { format!("hazure_read(){}\n", semicolon!()) },
|
||||
|
||||
"write_file" => { format!("hazure_write({}){}\n", self.gen_ir(&args[0], false), semicolon!()) },
|
||||
"read_file" => { format!("hazure_read_file({}){}\n", self.gen_ir(&args[0], false), semicolon!()) },
|
||||
|
||||
"time" => { format!("hazure_get_time(){}\n", semicolon!()) },
|
||||
_ => unreachable!(format!("Unknown intrinsic: {}", name)) // Shoul be handled by lowering
|
||||
}
|
||||
|
|
10
lib/io.hpp
10
lib/io.hpp
|
@ -5,7 +5,7 @@
|
|||
|
||||
template<typename T>
|
||||
/**
|
||||
* @brief Read the value from stdin and return it.
|
||||
* Read the value from stdin and return it.
|
||||
*/
|
||||
T hazure_read() {
|
||||
T x;
|
||||
|
@ -15,8 +15,8 @@ T hazure_read() {
|
|||
|
||||
template<typename T>
|
||||
/**
|
||||
* @brief Prints the value of the variable to the stdout.
|
||||
*
|
||||
* Prints the value of the variable to the stdout.
|
||||
*
|
||||
* @param value The value to print.
|
||||
*/
|
||||
void hazure_write(T x) {
|
||||
|
@ -24,7 +24,7 @@ void hazure_write(T x) {
|
|||
}
|
||||
|
||||
/*
|
||||
* @brief Read the value from the file and return it.
|
||||
* Read the value from the file and return it.
|
||||
*
|
||||
* @param file_name The name of the file to read from.
|
||||
* @return std::string The value read from the file.
|
||||
|
@ -37,7 +37,7 @@ std::string hazure_read_file(std::string filename) {
|
|||
}
|
||||
|
||||
/*
|
||||
* @brief Write string to file.
|
||||
* Write string to file.
|
||||
*
|
||||
* @param filename The file name to write to.
|
||||
* @param content The content to write.
|
||||
|
|
Loading…
Reference in a new issue