The Tomo programming language
Go to file
2024-04-03 03:08:40 -04:00
builtins Publicly export CORD_asprintf symbol for libfile 2024-04-03 03:04:14 -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 Add test for array:sample() 2024-04-02 23:41:26 -04:00
.gitignore Hook things up so the compiler can run better without installing 2024-04-03 03:08:40 -04:00
ast.c Add comparison operator <> and array method to sort by a custom 2024-04-02 13:08:06 -04:00
ast.h Add comparison operator <> and array method to sort by a custom 2024-04-02 13:08:06 -04:00
compile.c Add array:sample(n, weights) 2024-04-02 23:40:18 -04:00
compile.h Module imports 2024-03-19 14:22:03 -04:00
enums.c Switch naming convention to use '$' in symbols more 2024-03-29 12:54:31 -04:00
enums.h More file comments 2024-03-18 12:49:38 -04:00
environment.c Switch naming convention to use '$' in symbols more 2024-03-29 12:54:31 -04:00
environment.h Adding a REPL 2024-03-30 12:14:24 -04:00
Makefile Dynamically link against .so file instead of statically linking against 2024-04-03 03:04:42 -04:00
parse.c Add comparison operator <> and array method to sort by a custom 2024-04-02 13:08:06 -04:00
parse.h More file comments 2024-03-18 12:49:38 -04:00
README.md More docs 2024-03-10 00:42:59 -05: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 Switch naming convention to use '$' in symbols more 2024-03-29 12:54:31 -04:00
structs.h More file comments 2024-03-18 12:49:38 -04:00
tomo.c Hook things up so the compiler can run better without installing 2024-04-03 03:08:40 -04:00
typecheck.c Add array:sample() 2024-04-02 23:28:59 -04:00
typecheck.h Switch naming convention to use '$' in symbols more 2024-03-29 12:54:31 -04:00
types.c Add comparison operator <> and array method to sort by a custom 2024-04-02 13:08:06 -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()

>> greeting("world")
= "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
  • 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.

Both of which 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