sample.trp 752 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #! /usr/bin/tripl
  2. < "libc-2.33.so" @ shared;
  3. # now we're testing the c-style declares
  4. int main(int argc, const char **argv);
  5. extern int fputs(char *, int);
  6. # and tripl-style
  7. < add(a, b) @ fn;
  8. $ a;
  9. $ b;
  10. $ c;
  11. -10 -> a;
  12. a = b = 1000;
  13. a = ` "/usr/bin/bash" {
  14. echo "greeting from bash :-)"
  15. exit 100
  16. };
  17. c = ` "./tripl" {
  18. $ a;
  19. a = ` "/usr/bin/bash" {
  20. echo -n "this is a bash and it is running in a tripl-interpreter which"
  21. echo "are running in a tripl-interpreter"
  22. exit 10
  23. };
  24. ! var;
  25. };
  26. b = ` "/usr/bin/python3" {
  27. print("hello, this is python world and this python is running in tripl :-)")
  28. exit(1);
  29. };
  30. # @ var means, only view value of var, but not functions and libraries.
  31. ! @ var;
  32. b = a = $ 1 + 1 * 100 / 12;
  33. !;