Advertisement
Guest User

Untitled

a guest
May 25th, 2015
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.94 KB | None | 0 0
  1. Ash is shortly compiled to improve the speed.
  2. It's possible but unrequired and slow/less optimized to work directly in compiled Ash.
  3.  
  4. :os:bin/ashc [file] [output]
  5. inputs a .ash, outputs a .cash
  6.  
  7. :os:bin/ashi [file]
  8. interprets a .cash
  9.  
  10. example
  11.  
  12. usr$ :os:bin/ashc myscript.ash mycompiledscript.cash
  13.  
  14. Ash compiler
  15. Pass 1, 2, 3, 4, 5, 6
  16. File compiled to "mycompiledscript".cash!
  17. [0 warning, 0 error]
  18.  
  19. usr$ :os:bin/ashi mycompiledscript.cash
  20. Loading Ash interpreter...
  21. [!] Ran as normal user.
  22. Some functions may not work and cause the script to crash.
  23.  
  24. usr$
  25.  
  26. code sample:
  27.  
  28. 0->number; # Set 0 to number
  29. getline->text; # Get a line and assign text to it
  30. if text == "test":
  31. cout "Hello world";
  32. end
  33. number++
  34. cout number;
  35.  
  36. Compile step #1 : Remove comments.
  37. 0->number;
  38. getline->text;
  39. if text == "test":
  40. cout "Hello world";
  41. end;
  42. number++;
  43. cout number;
  44.  
  45. Compile step #1 : Remove unrequired spaces and indentation and jumplines
  46. 0->number;getline->text;if text=="test" :cout "Hello world";end;number++;cout number;
  47.  
  48. Compile step #2 : Shorten names (obfuscated) - Allows up to 24² variables
  49. 0->aa;getline->ab;if ab=="test" :cout "Hello world";end;aa++;cout aa;
  50.  
  51. Compile step #3 : Shorten operators
  52. 0@aa;getline@ab;if ab="test" :cout "Hello world";#;aa$;cout aa;
  53.  
  54. Compile step #4 : Remove ';' after ends, remove last ';', remove unrequired spaces
  55. 0@aa;getline@ab;ifab="test":cout "Hello world";#aa$;cout aa
  56.  
  57. Compile step #5 : Shorten functions/other names (with prefix °)
  58. 0@aa;°gl@ab;°ifab="test":°co "Hello world";#aa$;°co aa
  59.  
  60. Compile step #6 : Remove unrequired spaces again
  61. 0@aa;°gl@ab;°ifab="test":°co"Hello world";#aa$;°coaa
  62.  
  63. Interpreter behavior :
  64. 0 - value found, ready to assign
  65. @ - assignement operator found
  66. aa - variable found, assignement known, assigning 0 to aa
  67. ; - found, forgetting temp data of the previous line
  68.  
  69. ° - found, excepting a function/other name
  70. gl - found, checking next token
  71. @ - assignement operator found, getting gl returned value
  72. ab - found, assigning the returned value to ab
  73. ; - found, forgetting temp data of the previous line
  74.  
  75. ° - found, excepting a function/other name
  76. if - found, reading statment
  77. ab - variable found, reading value
  78. = - equality operator found, excepting value
  79. " - string found, read value until ". comparing this value to ab's value.
  80.  
  81. false : read amount of ends (#) + if/for/repeat/while. when == 0, continue going
  82. true : keep going after the ':'
  83.  
  84. ° - found, excepting a function/other name
  85. co - found, checking next token
  86. " - found, no operator between, co is a function. read value until ". passing the value to co.
  87. ; - found, forgetting temp data of the previous line
  88.  
  89. # - found, skipping
  90. aa - variable found
  91. $ - ++ operator found, incrementing aa
  92. ; - found, forgetting temp data of the previous line
  93.  
  94. ° - found, excepting a function/other name
  95. co - found, checking next token
  96. aa - found
  97. (EOF) - found, reading aa's value and passing to co
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement