Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ash is shortly compiled to improve the speed.
- It's possible but unrequired and slow/less optimized to work directly in compiled Ash.
- :os:bin/ashc [file] [output]
- inputs a .ash, outputs a .cash
- :os:bin/ashi [file]
- interprets a .cash
- example
- usr$ :os:bin/ashc myscript.ash mycompiledscript.cash
- Ash compiler
- Pass 1, 2, 3, 4, 5, 6
- File compiled to "mycompiledscript".cash!
- [0 warning, 0 error]
- usr$ :os:bin/ashi mycompiledscript.cash
- Loading Ash interpreter...
- [!] Ran as normal user.
- Some functions may not work and cause the script to crash.
- usr$
- code sample:
- 0->number; # Set 0 to number
- getline->text; # Get a line and assign text to it
- if text == "test":
- cout "Hello world";
- end
- number++
- cout number;
- Compile step #1 : Remove comments.
- 0->number;
- getline->text;
- if text == "test":
- cout "Hello world";
- end;
- number++;
- cout number;
- Compile step #1 : Remove unrequired spaces and indentation and jumplines
- 0->number;getline->text;if text=="test" :cout "Hello world";end;number++;cout number;
- Compile step #2 : Shorten names (obfuscated) - Allows up to 24² variables
- 0->aa;getline->ab;if ab=="test" :cout "Hello world";end;aa++;cout aa;
- Compile step #3 : Shorten operators
- 0@aa;getline@ab;if ab="test" :cout "Hello world";#;aa$;cout aa;
- Compile step #4 : Remove ';' after ends, remove last ';', remove unrequired spaces
- 0@aa;getline@ab;ifab="test":cout "Hello world";#aa$;cout aa
- Compile step #5 : Shorten functions/other names (with prefix °)
- 0@aa;°gl@ab;°ifab="test":°co "Hello world";#aa$;°co aa
- Compile step #6 : Remove unrequired spaces again
- 0@aa;°gl@ab;°ifab="test":°co"Hello world";#aa$;°coaa
- Interpreter behavior :
- 0 - value found, ready to assign
- @ - assignement operator found
- aa - variable found, assignement known, assigning 0 to aa
- ; - found, forgetting temp data of the previous line
- ° - found, excepting a function/other name
- gl - found, checking next token
- @ - assignement operator found, getting gl returned value
- ab - found, assigning the returned value to ab
- ; - found, forgetting temp data of the previous line
- ° - found, excepting a function/other name
- if - found, reading statment
- ab - variable found, reading value
- = - equality operator found, excepting value
- " - string found, read value until ". comparing this value to ab's value.
- false : read amount of ends (#) + if/for/repeat/while. when == 0, continue going
- true : keep going after the ':'
- ° - found, excepting a function/other name
- co - found, checking next token
- " - found, no operator between, co is a function. read value until ". passing the value to co.
- ; - found, forgetting temp data of the previous line
- # - found, skipping
- aa - variable found
- $ - ++ operator found, incrementing aa
- ; - found, forgetting temp data of the previous line
- ° - found, excepting a function/other name
- co - found, checking next token
- aa - found
- (EOF) - found, reading aa's value and passing to co
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement