The Tomo programming language
Go to file
2024-03-18 12:49:38 -04:00
builtins Improve comprehensions for both arrays and tables 2024-03-17 14:46:36 -04:00
docs Rename Str -> Text 2024-03-03 18:15:45 -05:00
test Clean up codegen for empty tagged data 2024-03-17 22:17:21 -04:00
.gitignore Rename 'nextlang'->'tomo' 2024-02-24 16:06:49 -05:00
ast.c Improve comprehensions for both arrays and tables 2024-03-17 14:46:36 -04:00
ast.h More file comments 2024-03-18 12:49:38 -04:00
compile.c Add some better file comments 2024-03-18 12:47:07 -04:00
compile.h More file comments 2024-03-18 12:49:38 -04:00
enums.c Add some better file comments 2024-03-18 12:47:07 -04:00
enums.h More file comments 2024-03-18 12:49:38 -04:00
environment.c Add some better file comments 2024-03-18 12:47:07 -04:00
environment.h More file comments 2024-03-18 12:49:38 -04:00
Makefile Remove some shadowed variables 2024-03-14 02:48:07 -04:00
parse.c Add some better file comments 2024-03-18 12:47:07 -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
structs.c Add some better file comments 2024-03-18 12:47:07 -04:00
structs.h More file comments 2024-03-18 12:49:38 -04:00
tomo.c Add some better file comments 2024-03-18 12:47:07 -04:00
typecheck.c Empty enums use a singleton instead of a constructor 2024-03-17 22:06:55 -04:00
typecheck.h More file comments 2024-03-18 12:49:38 -04:00
types.c Rearranging some files 2024-03-10 00:03:21 -05:00
types.h More file comments 2024-03-18 12:49:38 -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