Skip to content

Commit

Permalink
Recoded everything
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor committed Jul 31, 2024
1 parent 6610ebd commit 437dae8
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 525 deletions.
28 changes: 21 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
CC=rustc
CCARGS=-Ctarget-feature=+crt-static -Copt-level=3 -Cstrip=symbols -v
SRC=src/maeel.rs
TESTS=tests.maeel
EXE=maeel


all: build

fmt:
rustfmt $(SRC)

build:
rustc src/maeel.rs -Copt-level=3 -o maeel
$(CC) $(CCARGS) $(SRC) -o $(EXE)

nvim:
rm ~/.config/nvim/syntax/maeel.vim && cp editor_impls/vim/maeel.vim ~/.config/nvim/syntax
rm -f ~/.config/nvim/syntax/maeel.vim
cp editor_impls/vim/maeel.vim ~/.config/nvim/syntax

vscode:
rm -rf ~/.vscode/extensions/maeel-syntax-highlighting 2>/dev/null && cp -r editor_impls/vscode ~/.vscode/extensions/maeel-syntax-highlighting
rm -rf ~/.vscode/extensions/maeel-syntax-highlighting 2>/dev/null
cp -r editor_impls/vscode ~/.vscode/extensions/maeel-syntax-highlighting

test: build
./$(EXE) $(TESTS)

test:
rustc src/maeel.rs -o maeel && ./maeel tests.maeel
bench: build
hyperfine --runs 1000 "./$(EXE) $(TESTS)"

bench:
rustc src/maeel.rs -o maeel && hyperfine --runs 1000 "./maeel tests.maeel"
41 changes: 6 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,11 @@ The interpreter is made of ~ 600 lines of code :3 Indeed a lot of maeel features

`$ ./maeel program.maeel`

## Hello, world!
## Implemented in maeel

```
"Hello, world" puts
```
- Stack functions (drop, dup, rot, over, swap)
- Booleans functions (and, or, not)
- Conditions (ifelse, then) (s/o Turring)
- Loops (while, for)
- Lists definition (List ... end)

## Variables

```
<anything on the stack> ~ <variable name>
```

```
"hello" ~ hello
```

## Functions

```
fun name x y z (x y + z *)
```

maeel also supports inline functions:

```
fun inline name (+ *)
```

## Conditions

```
<boolean on the stack> ? (<executed if boolean is 1>)
```

```
<boolean on the stack> (<executed if true>) (<executed if false>) ifelse
```
Loading

0 comments on commit 437dae8

Please sign in to comment.