https://github.com/zdimension/macro-forth
Compile-time const Forth evaluation with macros
https://github.com/zdimension/macro-forth
compile-time forth macro rust
Last synced: 10 months ago
JSON representation
Compile-time const Forth evaluation with macros
- Host: GitHub
- URL: https://github.com/zdimension/macro-forth
- Owner: zdimension
- License: mit
- Created: 2022-08-23T20:44:16.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-11-13T14:38:29.000Z (over 3 years ago)
- Last Synced: 2025-03-26T03:04:41.359Z (11 months ago)
- Topics: compile-time, forth, macro, rust
- Language: Rust
- Homepage:
- Size: 2.93 KB
- Stars: 35
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# macro-forth
Forth, in macros.
```rust
fn main() {
const TWO: i32 = forth!(5 3 -);
forth!(
TWO . // 2
);
const HUNDRED: i8 = forth!(
1 2 dup * + dup + // 10
dup * // 100
hundred !
3 dup swap drop drop
hundred @
);
forth!(
HUNDRED @ dup . // 100
50 > if "bigger" else "smaller" then . // bigger
);
}
```