bb_tech.txt 826 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. Blitz Basic internals.
  2. * Language
  3. Declarations:
  4. 4 types: Newtype, Function, Var, Array
  5. Forward referencing for NewTypes and Functions is allowed.
  6. Array declarations are through Dim statement.
  7. Var declarations are through Var statement or params.
  8. Only Var declarations may appear in functions.
  9. * Runtime
  10. Newtype objects in BB look like this:
  11. struct BBObj{
  12. BBObj *curr;
  13. int ref_cnt;
  14. BBObj *next,BBObj *prev;
  15. };
  16. When an object is 'used' (for field access or in an expression), it's
  17. curr field should be fetched.
  18. When an object is assigned, prev obj refcnt is decremented, new refcnt
  19. is incremented.
  20. The curr field is 0 if the object has been deleted.
  21. All objects exist in a type list:
  22. struct BBType{
  23. int obj_size
  24. BBObj usedList,freeList;
  25. };
  26. An object stays in it's type list as long as it's ref_cnt is >0.