Cmajor 1.5.0 released


Cmajor compiler version 1.5.0 released:


Source code also in GitHub:


Cmajor is a hybrid programming language based on C++ and C#.
Its syntax is closer to C#'s than C++'s syntax and semantics
closer to C++'s semantics than C#'s semantics.

It's not garbage collected but relies on destructors doing
the cleanup as in C++.

It runs on Windows and Linux, has LLVM and C backends,
has basic implementation of concepts, has an IDE in Windows,
and has support for debugging integrated in IDE in Windows
and using command line tool cmdb in Linux.

New in this release:
o    Code completion in the editor (not perfect but mostly usable).
o    A document about implementation of the Cmajor compiler:
     Implementation.pdf in the doc subdirectory.
o    constexpr: a function declared constexpr is evaluated
at compile time if given literal arguments of a basic
type (int, uint, long, ulong, etc.).
A constexpr function can call other constexpr functions.
It can also be a function template.
It can be called in contexts where a compile time constant is
expected. When argument is not a literal it behaves as an
ordinary function. constexpr is a new keyword.

For example:

public constexpr factorial(int n)
    if (n == 0) return 1;
    return n * factorial(n - 1);
public const int fact5 = factorial(5);

It is planned that in future the argument can also be
an instance of a literal class type, where literal class type
is sufficiently simple nonpolymorphic class type.

o Intrinsic type predicates.
There's now some intrinsic compile time Boolean functions
that answer questions about types in System.Meta namespace:
bool IsLvalueReferenceType<T>();
bool IsRvalueReferenceType<T>();
bool IsReferenceType<T>();
bool IsConstType<T>();
bool IsPointerType<T>();
bool IsIntegerType<T>();

bool IsClassType<T>();


o Predicate constraints for concept checking.
One can call a constexpr or an intrinsic predicate function
in a where-constraint:

public int foo<T>() where IsPointerType<T>()
// ...

o System.Numerics.Multiprecision library has now BigFloat and
BigRational classes.

o Updated to LLVM version 3.8.1 and GCC version 5.4.0.

Seppo Laakko
8/31/2016 4:06:06 PM
comp.compilers 3310 articles. 0 followers. Post Follow

0 Replies

Similar Articles

[PageSpeed] 50