Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
eb83ed3
Add struct
mpolosak Jun 5, 2025
047008c
Comparing for structs
mpolosak Jun 5, 2025
af05970
StructType.matches
mpolosak Jun 5, 2025
0f4d44f
Add struct type literal
mpolosak Jun 5, 2025
2e14aa5
var_type macro support struct
mpolosak Jun 5, 2025
5052a40
Add Type::field_type
mpolosak Jun 5, 2025
8d5a4f6
Fix tuple_element_at, add test for it
mpolosak Jun 5, 2025
cacb695
Add Type.is_struct and Type.has_field
mpolosak Jun 5, 2025
161b934
Add field_access
mpolosak Jun 5, 2025
d0320ac
Add struct literal
mpolosak Jun 5, 2025
eb00e78
export macro creates struct instead function inserting to Interpreter
mpolosak Jun 5, 2025
96f64bd
Add struct to var!()
mpolosak Jun 5, 2025
402ed82
Add parse struct from str
mpolosak Jun 6, 2025
67bbc0b
All of std inside std struct
mpolosak Jun 6, 2025
bec4314
Short syntax for struct fields
mpolosak Jun 19, 2025
eb24268
Fix some of clippy warnings
mpolosak Jun 19, 2025
fefda5b
Add mod for creating structs
mpolosak Jul 17, 2025
3b20e8e
Replace some match with if let
mpolosak Jul 17, 2025
da93912
Import produces struct
mpolosak Jul 17, 2025
269a4bc
Update stdlib.md
mpolosak Jul 18, 2025
75ee579
Fix ~ operator
mpolosak Jul 26, 2025
4e659e8
Fix examples
mpolosak Jul 26, 2025
860b374
Fix clippy error
mpolosak Jul 29, 2025
1754c3a
Remove struct s
mpolosak Jul 30, 2025
62669a5
ExecError and ParseTypeError use derive display from derive_more
mpolosak Jul 31, 2025
7c847b4
Add test for Type::to_string
mpolosak Jul 31, 2025
aed80a6
Use derive_more::Display to implement Display for Type
mpolosak Jul 31, 2025
c97c310
Replace manual Display impl with derive in variable mod
mpolosak Jul 31, 2025
2658ef6
Replace manual Display impl with derive in function mod
mpolosak Jul 31, 2025
eb44b1f
Better Export macro
mpolosak Aug 1, 2025
a8b3118
export macro can now export function, move len function from std.stri…
mpolosak Aug 1, 2025
89ec6aa
Add decls macro
mpolosak Aug 4, 2025
52044c3
Use derive_more::From
mpolosak Aug 23, 2025
c6e719f
Struct field are initialized in order of declaration
mpolosak Sep 2, 2025
9b6474a
Use std::slice::from_ref
mpolosak Sep 3, 2025
d3a8366
Implement From instead of TryFrom Infallible
mpolosak Sep 3, 2025
0629604
Add functions to stdlib
mpolosak Oct 1, 2025
111f2af
Use struct { error_code, msg} instead of (int, msg)
mpolosak Oct 1, 2025
d0e292e
Struct fields use := instead of =
mpolosak Oct 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pest = "2.7"
lazy_static = "1.5.0"
simplesl_parser = { path = "parser", version = "0.1.0" }
unescaper = "0.1.5"
itertools = "0.14.0"

[package]
name = "simplesl"
Expand All @@ -24,14 +25,14 @@ simplesl_macros = { path = "macros", version = "0.1.0" }
match_any = "1.0.1"
duplicate = "2.0.0"
enum-as-inner = "0.6.1"
derive_more = { version = "2.0.1", features = ["display"] }
derive_more = { version = "2.0.1", features = ["display", "from"] }
slyce = "0.3.1"
pest.workspace = true
lazy_static.workspace = true
simplesl_parser.workspace = true
unescaper.workspace = true
itertools.workspace = true

[dev-dependencies]
itertools = "0.14.0"
markdown = "0.3"
proptest = "1.6.0"
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use simplesl::{Code, Interpreter};

fn main() {
let interpreter = Interpreter::with_stdlib();
let _ = Code::parse(&interpreter, "print(\"Hello world!\")")
let _ = Code::parse(&interpreter, "std.io.print(\"Hello world!\")")
.unwrap()
.exec();
}
Expand All @@ -26,7 +26,7 @@ fn main() {
## Syntax
### Hello world example
```SimpleSL
print("Hello world")
std.io.print("Hello world")
```
### Comments
Comment works like in C or Rust
Expand All @@ -35,7 +35,7 @@ Comment works like in C or Rust
/*
Multiline comment
*/
print("Hello world"/* Comment */)
std.io.print("Hello world"/* Comment */)
```
### Variables
```SimpleSL
Expand All @@ -49,16 +49,17 @@ x := [0; 5] // array containg five zeros
tuple := (5, 7.8, "value") // tuple
{
tuple := (4, "rgg", 56)
print(tuple) // prints (4, "rgg", 56)
std.io.print(tuple) // prints (4, "rgg", 56)
}
print(tuple) //prints (5, 7.8, "value")
std.io.print(tuple) //prints (5, 7.8, "value")
```
### Functions
```SimpleSL
delta := (a: float, b: float, c: float) -> float {
return b**2.0+4.0*a*c
} // function taking free arguments of type float and returning value of type float
name := "Tom"
print:=std.io.print;
x := (){
print("Hello "+name);
}
Expand Down
3 changes: 2 additions & 1 deletion docs/statements.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import path
```
path is string literal
Imports code from given path. Importing happens during parsing. Import statement is replaced with code read from file.
Imports code from given path. Importing happens during parsing. Import produces a struct holding
all variables declared in the file

## return
```
Expand Down
Loading