diff --git a/readme.md b/readme.md index 97e4117..d609663 100644 --- a/readme.md +++ b/readme.md @@ -6,9 +6,46 @@ Rust developers hate it, Python developers fear it, and C developers make it bli ## How to Strath ### Comments +`;` all text after a semicolon will be treated as a comment +`&&` all text after a double and will be treated as a comment +`]][[` an inline command, all text between the double square brackets will be treated as a comment +\`\`´´ this makes a multiline comment ### If, else if/elif, else +`¿??/condition\? | ()` - if +`?>/condition\? | ()` - elif/else if +`\>?/condition\? | ()` - else + +After `??` and `?>` either a `$` or `€` to declare if all conditions are to be true or false respectivly +Two variables will be compared by an if statment without "==" eg `¿??$/1 1\? | ()` compares if 1 == 1 and if that result needs to be true to run the code in between the two round brackets ### Variable Types +`}}type{{` uses the standard types like int, str, float, etc -### Working With Variables +Certain types have short declarations +`ö` declares ints +`Ö` declares floats +`ä` declares char +`Ä` declares string +`ü` declares list +`Ü` declares dict + +wavey brackets aren't needed in this case + +#### Working With Variables +Variables are declared by defining the type, the name, and the value (optional) eg: +`}}int{{ i < 1;` + +`}int{ i < 1;` A single wavy bracket allows the type of the var to change dynamicly + +Special behaviour: +`j > i` will copy i to j and drops i +`j < i` will copy i to j and maintain i + +### In-build functions +`<=` will output a value +`=>` takes an input and sets the next variable to it as the input + +### Code +`¡!` are statments +`¿?` are expression diff --git a/sm-test-files/animals-example/animal.sm b/sm-test-files/animals-example/animal.sm index 9bc5858..f82341c 100644 --- a/sm-test-files/animals-example/animal.sm +++ b/sm-test-files/animals-example/animal.sm @@ -2,7 +2,8 @@ && '++name declares an abstract class && all of that is, of course, a statement so ¡! -'++animal ( + +&<='++animal ( && +}}type{{ declares a property of a class && "+}}type{{ declares a static property of a class @@ -14,7 +15,7 @@ ¡<=/"Created animal named " + name\!; && +var refers to a property, like this. in other languages - && you can only assign values to static variables once in this language + && you can only assign values to static variables once in this language ¡+name < name!; ¡+speed < speed!; ) diff --git a/sm-test-files/animals-example/cat.sm b/sm-test-files/animals-example/cat.sm index f015cdd..c811928 100644 --- a/sm-test-files/animals-example/cat.sm +++ b/sm-test-files/animals-example/cat.sm @@ -3,32 +3,6 @@ && inherit via ::: ++cat:::animal ( -<<<<<<< HEAD - ¡+}}float{{ meowingVolume!; - - ### /}}string{{ name\ /}}float{{ speed\ /}}float{{ meowingVolume\ | ( - && ## calls the super - ¡##/name, speed\!; - ¡+meowingVolume < meowingVolume!; - ) - - +#meow /\ | ( - ¿??€/+meowingVolume >> 0\ | ( - ¡<=/"*silence*"!; - ) ?>$/+meowingVolume >> 0\ | ( - ¡<=/"mow"\!; - ) ?>$/+meowingVolume >> 2\ | ( - ¡<=/"meow"\!; - ) ?>$/+meowingVolume >> 5\ | ( - ¡<=/"Meow."\!; - ) ?>$/+meowingVolume >> 10\ | ( - ¡<=/"Meow!!"\!; - ) ?>$/+meowingVolume >> 20\ | ( - ¡<=/"MEOW!!!"\!; - ) >? | ( - !<=/"Error: weird as fuck meowing volume."\!; - ) -======= ¡+}}float{{ meowingVolume!; ### /}}string{{ name\ /}}float{{ speed\ /}}float{{ meowingVolume\ | ( @@ -58,6 +32,5 @@ ) >?/\? | ( !<=/"Error: weird as fuck meowing volume."\!; ->>>>>>> 602600c8ef3124194f256b9d0ef99d3d6a418abe ) )