Sysmel

GitHub – A SYStem MEtaprogramming Language

Sysmel is a metaprogramming language whose source code is composed of scripts that are directly evaluated to construct another program. The direct evaluation of a sysmel source leave traces in a module (a metamodel instance) which are further analyzed to perform the following task: - Type checking - Macro expansion - Program entities dependency analysis - SSA intermediate code generation and optimization - LLVM backend for native code generation - Spir-V backend for Vulkan shader generation

# Syntax overview

The sysmel language syntax is a hybrid between Smalltalk and C++. Some elements of the syntax are picked with the object of facilitating either metaprogramming, or numerical computations (e.g. the same operator precedence levels as in C). Many syntactic elements of the Sysmel syntax are actually syntactic sugar for message sends. Message sends are analyzed in two phases: 1. Unexpanded messages are looked up through the macro method dictionary and if a macro with a matching selector is found, the AST nodes for the unexpanded message send is expanded and analyzed by the matching macro. If macro with a matching selector is not found, then the unexpanded message send node is converted into an expanded message send node. 1. Expanded message sends have the same style of lookup mechanism as a standard Smalltalk message send. Since Sysmel is a statically typed language (but one of the types, ProtoObject is treated as a generic dynamic object type) messages are typed, and like in C++ they can be overloaded.

Unlike in Smalltak, in Sysmel there can be message sends without a receiver. These messages are bound to the namespace and they are looked through the lexical scoping chain. Messages without receiver are typically used for implementing macros that are expanded into AST nodes without syntactic correlation (i.e. they do not appear in the Sysmel grammar).