The Tomo programming language
Go to file
2024-04-17 13:52:07 -04:00
builtins Invert escaping so user symbols get prepended with "$" and builtin 2024-04-16 13:50:07 -04:00
docs updated docs 2024-03-18 13:34:11 -04:00
include Hook things up so the compiler can run better without installing 2024-04-03 03:08:40 -04:00
test Change table syntax to {key:value} instead of {key=>value} 2024-04-13 13:39:44 -04:00
.gitignore Hook things up so the compiler can run better without installing 2024-04-03 03:08:40 -04:00
ast.c Fix empty string check 2024-04-10 11:54:09 -04:00
ast.h Use leading underscore for file-local variables and functions instead of 2024-04-17 13:44:01 -04:00
compile.c Fix arg parsing 2024-04-17 13:52:07 -04:00
compile.h Module imports 2024-03-19 14:22:03 -04:00
enums.c Rename SSS_HASH_VECTOR -> TOMO 2024-04-14 21:58:49 -04:00
enums.h More file comments 2024-03-18 12:49:38 -04:00
environment.c Invert escaping so user symbols get prepended with "$" and builtin 2024-04-16 13:50:07 -04:00
environment.h Introducing the main() function 2024-04-12 13:09:31 -04:00
Makefile Exit with 1 on failure 2024-04-16 13:56:19 -04:00
parse.c Use leading underscore for file-local variables and functions instead of 2024-04-17 13:44:01 -04:00
parse.h More file comments 2024-03-18 12:49:38 -04:00
README.md Update readme 2024-04-12 14:28:41 -04:00
repl.c Add comparison operator <> and array method to sort by a custom 2024-04-02 13:08:06 -04:00
repl.h Adding a REPL 2024-03-30 12:14:24 -04:00
structs.c Rename SSS_HASH_VECTOR -> TOMO 2024-04-14 21:58:49 -04:00
structs.h More file comments 2024-03-18 12:49:38 -04:00
tomo.c Remove (void)argc/v 2024-04-16 12:56:59 -04:00
typecheck.c Use leading underscore for file-local variables and functions instead of 2024-04-17 13:44:01 -04:00
typecheck.h Switch naming convention to use '$' in symbols more 2024-03-29 12:54:31 -04:00
types.c Change table syntax to {key:value} instead of {key=>value} 2024-04-13 13:39:44 -04:00
types.h Handle type namespaces in other modules 2024-03-22 01:52:00 -04:00

Tomo - Tomorrow's Language

Tomo is a statically typed, safe, simple, lightweight, efficient programming language that cross-compiles to C. Tomo is designed to anticipate and influence the language design decisions of the future.

func greeting(name:Text)->Text
	greeting := "hello {name}!"
	return greeting:title()

func main(name="World")
	>> greeting(name)
	= "Hello World!"

Features

  • Extremely high performance code generation with minimal overhead compared to C
  • Extremely fast parallel compilation times
  • Memory safety (garbage collection, compiler-enforced null safety, automatic array bounds checking, and no uninitialized variables)
  • Arithmetic overflow checking
  • Simple, low-boilerplate type system with type inference
  • Useful and efficient built-in types: arrays, hash tables, structs, tagged unions (sum types), cords (efficient string representation)
  • Well-defined reference and value semantics and mutability rules
  • Language-level support for out-of-the-box function caching emphasizing correctness
  • Type-safe strings representing different languages with automatic prevention of code injection
  • Full UTF8 support for both source code and standard library
  • Pattern matching with exhaustiveness checking for tagged unions
  • Beautiful and helpful compiler and runtime error messages with emphasis on user-friendliness
  • Structs with known-at-compile-time methods, not OOP objects with vtable lookups
  • Built-in doctests with syntax highlighting
  • Built-in type-safe command line argument parsing
  • Easy interoperability with C

Dependencies

Tomo has a very small set of dependencies:

  • The Boehm garbage collector for runtime garbage collection.
  • libunistring for unicode string support.
  • a C compiler
  • and libc/libm, which should definitely already be installed.

The Boehm GC and libunistring should be available on your package manager of choice (for example, pacman -S gc libunistring).

Building

The Tomo compiler can be compiled with either GCC or Clang by running make.

Usage

Run a Tomo file directly:

tomo foo.tm
# Runs the program

Compile a Tomo file into an object file:

tomo -c foo.tm
# Output: foo.tm.o

Transpile a Tomo file into a C header and source file:

tomo -t foo.tm
# Outputs: foo.tm.h foo.tm.c

Tomo uses the environment variables ($CC, $VERBOSE, and $AUTOFMT), which control the compilation/running behavior of Tomo. The default behavior is to use tcc (Tiny C Compiler) for fast compilation, VERBOSE=0, and AUTOFMT='indent -kr -l100 -nbbo -nut -sob' for autoformatting generated code. Any of these variables may be overridden, e.g. CC=gcc VERBOSE=1 AUTOFMT= tomo foo.tm (compile with GCC and verbose compiler output without autoformatting the code).

Installing

make && sudo make install