test.g 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # This file is part of asmc, a bootstrapping OS with minimal seed
  2. # Copyright (C) 2018 Giovanni Mascellani <gio@debian.org>
  3. # https://gitlab.com/giomasce/asmc
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. # You should have received a copy of the GNU General Public License
  13. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  14. # Comments
  15. # Other comments
  16. const LEN 1024
  17. $glob
  18. %array 100
  19. %array2 LEN
  20. ifun test 1
  21. fun main 2 {
  22. $argc
  23. $argv
  24. @argc 0 param = ;
  25. @argv 1 param = ;
  26. $x
  27. @x argc argv + = ;
  28. argc test ;
  29. @argv argc = ;
  30. if x {
  31. @x 2 = ;
  32. } else {
  33. @x 4 = ;
  34. }
  35. while x {
  36. @x x 1 - = ;
  37. }
  38. @x glob = ;
  39. @glob x = ;
  40. x ret ;
  41. @glob LEN = ;
  42. @x '\n' = ;
  43. @x 100 = ;
  44. #@glob "Hello, ASM!" = ;
  45. #@glob "String\nwith\tescapes\"\'" = ;
  46. }
  47. fun test2 0 {
  48. 0 test ;
  49. }
  50. fun test 1 {
  51. }
  52. ifun test 1