https://github.com/kyza/gnal_tsur
https://github.com/kyza/gnal_tsur
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/kyza/gnal_tsur
- Owner: Kyza
- License: mit
- Created: 2023-08-21T07:32:40.000Z (almost 3 years ago)
- Default Branch: trunk
- Last Pushed: 2023-08-21T09:09:14.000Z (almost 3 years ago)
- Last Synced: 2024-05-28T16:30:26.140Z (about 2 years ago)
- Language: Rust
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gnal_tsur!
.esrever ni edoc etirW
## Features
- [x] Reversed tokens.
- [x] Reversed identifiers and literals.
## Usage
### `lang_rust!`
This macro reverses the order of every token in the code provided to it.
Even though the character order of identifiers and literals are untouched, the characters of punctuations are considered separate and are therefore reversed as well.
```rs
fn fibonacci(n: u32) -> u32 {
match n {
0 => 1,
1 => 1,
_ => fibonacci(n - 1) + fibonacci(n - 2),
}
}
lang_rust! {
{
{
,(2 - n)fibonacci + (1 - n)fibonacci >= _
,1 >= 1
,1 >= 0
} n match
} u32 >- (u32 :n)fibonacci fn
}
```
### `gnal_tsur!`
This macro is like `lang_rust!`, but it also reverses the order of characters in identifiers and literals.
```rs
fn fibonacci(n: u32) -> u32 {
match n {
0 => 1,
1 => 1,
_ => fibonacci(n - 1) + fibonacci(n - 2),
}
}
gnal_tsur! {
{
{
,(2 - n)iccanobif + (1 - n)iccanobif >= _
,1 >= 1
,1 >= 0
} n hctam
} 23u >- (23u :n)iccanobif nf
}
```