Skip to content

Commit 630c14c

Browse files
authored
version 1.4.0
Release of version 1.4.0!
2 parents aee9246 + 30adeec commit 630c14c

31 files changed

Lines changed: 1970 additions & 378 deletions

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
test2.mws
2-
test.mws
31
TODOLIST.txt
42
build
53
bin
64
.vscode
75
meow-script
6+
stdlib/threading.cpp
7+
testing/
8+
examples/big_project

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ set(SOURCE
1313
src/global.cpp
1414
src/main.cpp
1515
src/modules.cpp
16-
src/patterns.cpp
16+
src/objects.cpp
1717
src/reader.cpp
1818
src/runner.cpp
1919
src/scopes.cpp
2020
src/tools.cpp
2121
src/variables.cpp
22+
2223

2324
stdlib/filesystem.cpp
2425
stdlib/math.cpp

README.md

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,46 @@
11
# MeowScript
2-
A small interpreted easy extendable programming language.
3-
License: MIT
2+
3+
![Error Loading Image!](./assets/LogoLong.png)
4+
5+
<div id="badges">
6+
<img src="https://img.shields.io/github/v/release/LabRiceCat/MeowScript?label=latest&style=for-the-badge"/>
7+
</div>
8+
<img src="https://img.shields.io/github/license/LabRiceCat/MeowScript"/>
9+
10+
A small interpreted, easy extendable programming language.
411

512
## Requirements
6-
The requirements are:
7-
- CMake and Make
8-
- a C++ compiler
9-
- Either Windows or Linux (Other systems not tested, but might work to some extend)
10-
- Only on Windows:
11-
-- Msys2
12-
-- MinGW
13+
| | Compiler | BuildTool | Recomendet|
14+
|-------------|-------------------|---------------|-----------|
15+
| Linux | gcc/clang | cmake | ------- |
16+
| Windows* | mingw64-gcc/clang | nmake & cmake | Msys2 |
17+
| MacOS* | --------- | ---------- | ------- |
1318

14-
**Important: Windows build is currenlty officially NOT working!**
19+
\* still not 100% supported
1520

1621
## Installing
17-
Execute this commands in your shell:
22+
Execute this commands in your shell to download and build MeowScript.
1823
```
19-
$ git clone https://github.com/SirWolfi/MeowScript.git
24+
$ git clone https://github.com/LabRicecat/MeowScript.git
2025
$ cd MeowScript
2126
$ mkdir build
2227
$ cd build
2328
$ cmake ..
2429
$ make
2530
```
26-
If you use Windows, you can run the interpreter like this:
27-
```
28-
$ ./meow-script.exe --help
31+
Now you can run the interpreter!
2932
```
30-
If you use Linux, use this:
31-
```
32-
$ ./meow-script --help
33+
$ meow-script --help
3334
```
3435

3536
## How to use
36-
Please read the wiki [here](https://github.com/SirWolfi/MeowScript/wiki) to learn more about MeowScript.
37+
Get started **[here](https://github.com/SirWolfi/MeowScript/wiki)** to learn more about MeowScript!
3738

3839
## Try it out
39-
You can try out MeowScript live by using the `--shell` option.
40+
You can try out MeowScript live by using the `--shell` option or make a `main.mws` and run it with
41+
```
42+
$ meow-script main.mws
43+
```
44+
45+
## Credits
46+
Cute cat on the PC by DALL-E 2.0

assets/LogoLong.png

730 KB
Loading

assets/LogoSingle.png

692 KB
Loading

examples/big_project/main.mws

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import "menu"
2+
3+
Menu menu("Cool menu!",["Opt1","Opt2","Opt3"])
4+
5+
menu.request_option()

examples/big_project/menu.mws

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
struct Menu {
2+
new options []
3+
new name ""
4+
5+
gen_set options
6+
gen_get options
7+
gen_get name
8+
9+
func Menu(name_s :: String, options_s :: List)->Void {
10+
set options options_s
11+
set name name_s
12+
}
13+
14+
func screen_text()->String {
15+
new ret_str ""
16+
for i in {options.length()} {
17+
set ret_str (ret_str + {string((i+1))} + ". " + {string({options.at(i)})} + "\n")
18+
}
19+
return ret_str
20+
}
21+
22+
func get_option(idx :: Number)->Any {
23+
return {options.at((idx-1))}
24+
}
25+
26+
func get_input()->Number {
27+
new inp {input("> ")}
28+
new inp {number(inp)}
29+
30+
if({typeof inp} == "Void") {
31+
print "Invalid input!"
32+
return 0
33+
}
34+
35+
if(inp == 0 || inp > {options.length()}) {
36+
print "Invalid input!"
37+
return 0
38+
}
39+
40+
return inp
41+
}
42+
43+
func request_option()->Any {
44+
print ("---# " + name + " #---")
45+
print {screen_text()}
46+
new inp {get_input()}
47+
if(inp == 0) {
48+
return 0
49+
}
50+
51+
return {get_option(inp)}
52+
}
53+
54+
}

examples/big_project/node.mws

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
new nodes {}
2+
new error_bit 0
3+
4+
func node_count()->Number {
5+
return {nodes.length()}
6+
}
7+
8+
func add_node(name :: String, value)->Void {
9+
if({nodes.has(name)}) {
10+
set error_bit 1
11+
}
12+
else {
13+
nodes.set(name,value)
14+
set error_bit 0
15+
}
16+
}
17+
18+
func get_node()->Any {
19+
if({nodes.has(name)} == 0) {
20+
set error_bit 1
21+
return 0
22+
}
23+
return {nodes.get(name)}
24+
}

examples/stack.mws

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
struct Stack {
2+
new data []
3+
gen_get data
4+
5+
func push(d)->Void {
6+
data.push_back(d)
7+
}
8+
func pop()->Void {
9+
data.pop_back()
10+
}
11+
12+
func top()->Any {
13+
return {data.back()}
14+
}
15+
16+
func size()->Number {
17+
return {data.length()}
18+
}
19+
}
20+
21+
Stack stk()
22+
23+
stk.push(11)
24+
stk.push("hihi")
25+
stk.push([1,2,3])
26+
27+
while({stk.size()} != 0) {
28+
new top {stk.top()}
29+
stk.pop()
30+
print top
31+
}

inc/commands.hpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
MEOWSCRIPT_HEADER_BEGIN
99

10+
#define MWS_MUST_BE_IN_STRUCT() {if(global::in_struct == 0) {throw errors::MWSMessageException{"Command only allowed in struct!",global::get_line()};}}
11+
#define MWS_MUST_NOT_BE_IN_STRUCT() {if(global::in_struct != 0) {throw errors::MWSMessageException{"Command not allowed in struct!",global::get_line()};}}
12+
#define MWS_CAN_BE_IN_STRUCT()
13+
1014
struct CommandArgReqirement {
1115
std::vector<int> carry;
1216

@@ -39,6 +43,9 @@ struct CommandArgReqirement {
3943
}
4044
return carry[0] == car.carry[0];
4145
}
46+
bool operator!=(CommandArgReqirement car) {
47+
return !operator==(car);
48+
}
4249

4350
CommandArgReqirement(int i) {
4451
operator=(i);
@@ -51,7 +58,7 @@ struct CommandArgReqirement {
5158
bool has_carry(int in) const;
5259
bool matches(Token tk);
5360
bool matches(CommandArgReqirement car);
54-
bool matches(General_type type);
61+
//bool matches(General_type type);
5562
};
5663

5764
inline CommandArgReqirement car_Any = 0;
@@ -64,13 +71,16 @@ inline CommandArgReqirement car_Compound = General_type::COMPOUND;
6471
inline CommandArgReqirement car_Name = General_type::NAME;
6572
inline CommandArgReqirement car_Expression = General_type::EXPRESSION;
6673
inline CommandArgReqirement car_ArgumentList = General_type::ARGUMENTLIST;
74+
inline CommandArgReqirement car_ParameterList = General_type::PARAMETERLIST;
6775
inline CommandArgReqirement car_Operator = General_type::OPERATOR;
6876
inline CommandArgReqirement car_Module = General_type::MODULE;
6977
inline CommandArgReqirement car_Event = General_type::EVENT;
7078
inline CommandArgReqirement car_Keyword = General_type::KEYWORD;
7179
inline CommandArgReqirement car_Dictionary = General_type::DICTIONARY;
80+
inline CommandArgReqirement car_Object = General_type::OBJECT;
81+
inline CommandArgReqirement car_Struct = General_type::STRUCT;
7282
inline CommandArgReqirement car_PlaceHolderAble = car_Expression | car_Compound | car_Name;
73-
83+
inline CommandArgReqirement car_Ongoing = 200;
7484

7585
struct GeneralTypeToken;
7686

@@ -86,6 +96,8 @@ std::vector<Command>* get_command_list();
8696
bool is_command(std::string name);
8797
Command* get_command(std::string name);
8898

99+
Command* get_command_overload(std::string name,std::vector<Token> tokens);
100+
89101
MEOWSCRIPT_HEADER_END
90102

91103
#endif

0 commit comments

Comments
 (0)