Thursday, May 28, 2015

Spring Progress Update

How should one spend one's time...

I've focused on implementation since january and have regretfully not posted any progress updates. This is what's been done since then:


  • Symbol table rewrite - DONE
  • Central compiler "driver" routine incl options handling - DONE
  • Modules and import handling - DONE
  • Generic (parameterized) types except for reentrant code generation - DONE
  • Proper integer literal type handling, range checking and conversion - DONE
  • Bool type and boolean expressions - DONE
  • Polymorphism (virtual lookup) for static members - DONE
  • Function objects retaining their closure (e.g. 'self') - DONE
  • Preserve type information in references - DONE
  • 'self' implicit method argument - DONE
  • Virtual methods - DONE
  • 'new' operator and heap allocation - DONE
  • Initializers / constructors - DONE
  • super() constructor invocation; super.method() invocation - DONE


My next todos are:

  • Generic type instance fields support
  • Interfaces
  • Checked type casts (with special if statements)

But before that I need to do an important refactoring. Finding a clean way of modeling the grammar nodes, symbols, fields and types becomes rather difficult when name overloading and generic types are part of the mix. I think I've finally found the proper dimension along which to achieve separation of concern / modularization. (And as so often, in retrospect the solution looks rather trivial.)

Thursday, January 29, 2015

Essential Language Features

Added a static page called Essential Features. It attempts to describe on a single page what characterizes the Tuplex language - it's raison d'ĂȘtre so to speak!

Not all of them will be properly supported in the initial versions, but most are under way.

Currently I'm working with the generics implementation. It has turned out that even for doing a basic thing like a printf-style function, a lot of core semantic and code generation systems are needed.

Consider a simple String type:

public type String<L> derives Array<Char,L> {

  public static func length() UInt { return L }

  public func is_empty() Boolean { return self[0] == 0 }

}


It's just a handful of lines, but it requires a working version of all these systems, and generics is the one that isn't sufficiently capable yet:
  • Symbol tables and namespaces
  • Arrays
  • Objects
  • Static and non-static (instance) fields and methods
  • Inheritance/polymorphism
  • Generics (parameterized types)

Note btw how the length() method is both static and constant. In Tuplex the length is part of the array type, so it can be statically determined. In fact, type parameters are accessible directly (and why shouldn't they be, the information is there anyway!) so the method can be circumvented entirely:

  mystring := "foo"
  print( mystring.L )
--> 3

Thursday, January 15, 2015

Hello World

It's mandatory. This is what a hello world program currently looks like in Tuplex:


main() {
  tx.c.puts("Hello, world!");
}

Wednesday, November 5, 2014

Manifesto


The Tuplex Programming Language Manifesto

Tuplex aims to be a highly productive, high performance programming language that takes full advantage of modern, multi-core hardware. High productivity implies syntax and semantics that are easy to write and easy to read, as well as full language support for type safety, memory safety and thread safety. High performance implies that the language design does not encourage abstractions that can't be computed with high efficiency.
  1. Close to the metal - high performance
  2. Convenient, terse, readable syntax
  3. Orthogonal syntax, orthogonal semantics
  4. Type safe
  5. Memory safe
  6. Thread safe
  7. Source reflection
  8. Large software scalability

What Tuplex does not aim to provide

  • Direct access to memory addresses, registers etc
  • Abstraction from data representation details such as sizes of data types
  • Dynamic code loading (except for OS-level dynamic link libraries)

Paradigm and Syntax

Ok but what programming paradigm is Tuplex then?

It is an imperative language, with excellent support for functional programming, modern object-oriented programming and data-oriented programming. It draws the most influence from Java, Python and C++, and to some extent also Go, Haskell and Ada. To me personally the syntax feels a bit like a cross between Java, Python, and Go.