Skip to content

Commit

Permalink
Continue working on type checking...
Browse files Browse the repository at this point in the history
  • Loading branch information
Traumatism committed Jul 11, 2024
1 parent 3e225b2 commit 7888b41
Show file tree
Hide file tree
Showing 13 changed files with 180 additions and 44 deletions.
2 changes: 1 addition & 1 deletion examples/01_variables.maeel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"maeel" include
include "maeel"

"Hello, world" ~ hello_variable

Expand Down
2 changes: 1 addition & 1 deletion examples/02_arith.maeel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"maeel" include
include "maeel"

1 1 + putsln # will print 2
16 16 * putsln # will print 256
Expand Down
2 changes: 1 addition & 1 deletion examples/03_stack.maeel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"maeel" include
include "maeel"

# Stack: (from top to bottom)
# | 3 |
Expand Down
2 changes: 1 addition & 1 deletion examples/04_functions.maeel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"maeel" include
include "maeel"

fun proc ("hello from function" putsln)

Expand Down
2 changes: 1 addition & 1 deletion examples/05_conds.maeel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"maeel" include
include "maeel"

1 1+ 2= ? ("Yep!" putsln)

Expand Down
2 changes: 1 addition & 1 deletion examples/06_loops.maeel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"maeel" include
include "maeel"

List 1 2 3 4 end (putsln) for
"This is a sentence" (puts) for
Expand Down
2 changes: 1 addition & 1 deletion examples/07_arrays.maeel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"maeel" include
include "maeel"

List 1 2 3 4 5 end ~ this_is_a_list
this_is_a_list (1+) map ~ added_one
Expand Down
2 changes: 1 addition & 1 deletion examples/fib.maeel → examples/08_fib.maeel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"maeel" include
include "maeel"

fun fib n (n 1< (1) (n 1- fib n 2- fib +) ifelse)

Expand Down
8 changes: 4 additions & 4 deletions maeel.maeel
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ fun ifelse (1 rot 0 swap take4 match!)
# Example:
# - ``` 1 1 and ``` will return 1 (true)
# - ``` 1 0 and ``` will return 0 (false)
fun inline and (*)
fun inline and [Int Int -> Int] (*)

# Or function
# Usage: a b or
Expand All @@ -276,7 +276,7 @@ fun inline and (*)
# Example:
# - ``` 1 0 or ``` will return 1 (true)
# - ``` 0 0 or ``` will return 0 (false)
fun inline or (+ 0= 1 swap-)
fun inline or [Int Int -> Int] (+ 0= 1 swap-)

# Not function
# Usage: a not
Expand All @@ -286,7 +286,7 @@ fun inline or (+ 0= 1 swap-)
# Example:
# - ``` 1 not ``` will return 0 (false)
# - ``` 0 not ``` will return 1 (true)
fun inline not (1 swap-)
fun inline not [Int -> Int] (1 swap-)

# Xor function
# Usage: a b xor
Expand All @@ -296,7 +296,7 @@ fun inline not (1 swap-)
# Example:
# - ``` 1 0 xor ``` will return 1 (true)
# - ``` 1 1 xor ``` will return 0 (false)
fun inline xor (+ 2 %)
fun inline xor [Int Int -> Int] (+ 2 %)

fun inline pom (dup not)

Expand Down
2 changes: 1 addition & 1 deletion maeel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ impl BocchiVM {
self.push(Cord::Lst(content_bytes))
}
M_INCLUDE!() /* This is bad */ => {
let target = expect_stack!(Str, self, file, line);
let target = expect_token!(Str, tokens, file, line);

let content = match target.clone().as_str() {
"maeel" => include_str!(M_STD_LIB!()).to_string(),
Expand Down
3 changes: 1 addition & 2 deletions maeelc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ use std::io::Read;

mod maeellex;

#[macro_use]
use maeellex::*;
#[macro_use] use maeellex::*;

macro_rules! expect_token {
($token:tt, $tokens:expr, $fl:expr, $line:expr) => {{
Expand Down
Loading

0 comments on commit 7888b41

Please sign in to comment.