Skip to content

TL4 Features

Meir Cohen edited this page Apr 30, 2018 · 3 revisions

First "full" and "safe" compiler - all features to easily write a module, (almost) no crashes

  1. Function outputs with -> instead of :
  2. Ignore empty lines
  3. Any depth of sub-typing
  4. Every reference is treated as optional
  5. Specific output file
  6. Generate C89 standard code
  7. Enforce var and copy in primitives
  8. Support struct and class types only
  9. Dynamic pointer in reference
  10. Function objects
  11. Dynamic allocation in expression:Type{parameters}(...)
  12. Constructors: new(...)
  13. Managed and weak reference support
  14. Use is and is-not to compare references
  15. Read from stdin using sys.getchar and sys.getline
  16. Add file objects stdout, stdin, stderr
  17. Removing EOF, char getters now also return whether EOF reached
  18. Re-support native to run external C code
  19. Can extend generic types
  20. Basic error handling
    try
      # an error here will jump to the end of the block (and will be ignored)
    catch
      # if an error happens this block will run
    
  21. For-each loop: for [value] in [iterator], an iterator is a number, string, array, or any type with functions has()->(Bool), get()->([type]) and next(), [value] should be a variable of type [type]
  22. Complex members
  23. Change documentation to start and end with ~~~, comment line symbol to be ; and comment block to start with [; and end with ;]
  24. Verbose run-time errors, can raise with message: raise [string expression]
  25. Multi-line strings:
    str := "multi
        line
        string"
    ; is like
    str := "multi\nline\nstring"
    ; and
    str := "split\
        line"
    ; is like
    str := "splitline"
    
  26. Code coverage: mr4-compiler -t [tested-module] ...
  27. Better mocking:
    • can mock builtin functions mock Sys.println(user String s) ...
    • can call mocked function func.mocked(...)
    • can deactivate and activate mocks func.active := false
  28. Int constants: const Int NAME [value]
  29. Basic Enums:
    ; decleration
    enum Name
      VALUE
      ANOTHER-VALUE
    ; usage
    Name.VALUE
    Name.length
    
  30. Basic module system: each file should start with module [module-name]

Clone this wiki locally