betseg helped imnporeove let and let_mut
This commit is contained in:
parent
9e85522619
commit
6568820407
7
main.c
7
main.c
|
@ -1,9 +1,8 @@
|
||||||
#include <stdio.h>
|
|
||||||
#include "rust.h"
|
#include "rust.h"
|
||||||
|
|
||||||
fn main() {
|
fn(main(), int) {
|
||||||
let_mut_int a = 7;
|
let_mut(a, int) = 7;
|
||||||
print("Hello, World!\n");
|
|
||||||
a += 1;
|
a += 1;
|
||||||
|
print("Hello, World!\n", a);
|
||||||
Ok();
|
Ok();
|
||||||
}
|
}
|
||||||
|
|
15
rust.h
15
rust.h
|
@ -1,17 +1,14 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#define fn int
|
|
||||||
#define let_int const int
|
|
||||||
#define let_float const float
|
|
||||||
#define let_bool const bool
|
|
||||||
#define let_char const char
|
|
||||||
|
|
||||||
#define let_mut_int int
|
#define fn(decl, type) type decl
|
||||||
#define let_mut_float float
|
#define let(decl, type) const type decl
|
||||||
#define let_mut_bool bool
|
#define let_mut(decl, type) type decl
|
||||||
#define let_mut_char char
|
|
||||||
|
|
||||||
#define print printf
|
#define print printf
|
||||||
#define loop while(true)
|
#define loop while(true)
|
||||||
#define Ok(); return 0
|
#define Ok(); return 0
|
||||||
#define Err(); return 1
|
#define Err(); return 1
|
||||||
|
|
||||||
|
#define enum union
|
||||||
|
|
Loading…
Reference in a new issue