terebinth update

A little while back, I was working on writing an interpreted programming language using C++ as the medium for the interpreter implementation. The repository for that project can be found here, and it has since been converted to a public archive. I was in the middle of investigating the feasibility of modernizing the underlying C++ implementation by moving from C++17 to C++20 with modules, but that task proved Herculean. I abandoned the project for quite awhile until I made a concerted effort a few days ago to get involved again. I soon realized why I had abandoned the modernization effort in the first place, and I considered cessation of the project altogether.

I then had the idea to just archive the original implementation of the project as-is, but instead of discarding the project entirely, I have now decided to pursue reimplementing the code in Rust. This would ensure that the foundation of the terebinth language would be memory-safe and robust. I also decided to change the way I approached the terebinth language. Instead of creating an interpreter, terebinth will now be a compiled language with the full compiler stack written in Rust.

This effort will require a lot of time and dedication, but I am willing to invest the resources necessary to complete this project. The new terebinth repository can be found on GitHub, and a release is available on crates.io. It should be noted that the release is not at all a working product; I published a rough cut just so I could reserve the package name. Subsequent releases will follow as I make progress on the compiler. I will post updates here as well, as I have done with previous projects such as open-dis-rust (which should be moving out of alpha and into beta releases soon).

I plan to clean up a lot of the loose ends that I have currently on GitHub, whether that mean that I delete/archive repositories or get those in-development projects to a state where they are finalized and released. Once that has been accomplished, I will have more of my attention to devote to finishing open-dis-rust and terebinth. As things progress, updates will be posted here if such changes warrant.

This project was something that I wanted to do simply out of curiosity and out of desire for a challenge. I am still very much learning the fundamentals of writing compilers and developing a good programming language, and I don’t anticipate that terebinth will ever be useful to the industry; that doesn’t matter to me, though. I see this as an opportunity for growth and development as a professional in the field of computer science, so the success of the project is not as important as the completion of it. This is a project that I hope will serve as a stepping stone, as something that serves as a building block for bigger and better software in the future.

Pre-release: open-dis-rust v0.1.0-alpha.8

This is the second pre-release of the day! With this publication, the Logistics family of PDUs has been completed. Now, only 17 PDUs remain. In reviewing the README within the source tree, I realized that I had two PDU types listed that actually do not exist within the standard. I was using the Open DIS C++ library as a reference originally, and it, too, referenced PDUs that did not exist in the IEEE 1278.1 standard. So, having removed those errors, there are now only 17 PDUs left to implement. The remaining PDUs are primarily members of the Entity Management and Synthetic Environment protocol families.

Pre-release: open-dis-rust v0.1.0-alpha.7

With this pre-release version, the Minefield protocol family has been implemented. There are now 24 outstanding PDUs that need to be implemented according to the 2012 version of the IEEE 1278.1 standard. All the latest documentation regarding this pre-release is available on the crates.io page for the package.

Basic Enumerations

An enumeration, or enum in Rust, is a way to declare a custom data type that describes, or enumerates, possible variations of a certain category. In the example below, the data type is named Language, and it serves as the category for which all the named items within are a part. EnglishSpanish, etc. are all a member of the Language enumeration. Enumerations are implicitly given an integer value corresponding with their ordinal position within the definition, starting with 0. Unless expressly overridden, the numerical value of each member increments by 1. These types of enumerations are classified as unit-only enums. Other types of enumerations are described in detail in the Advanced Enumerations section.

// Unit-only enumeration
enum Language {
  English,  // = 0
  Spanish,  // = 1
  Italian,  // = 2
  French,   // = 3
  German,   // = 4
}
// Overridden unit-only enumeration
enum Country {
  America = 4,
  Germany,  // = 5
  France,   // = 6
  Austria = 8,
}

Constants

The const keyword is similar to the let keyword: it allows the creation of an immutable variable. Constants can never be mutable, and they must always be set to a constant expression, i.e., something that has a definite value and that is not the result of a runtime calculation.

const GRAVITY: f32 = 9.801;
const PI: f32 = 22 / 7;
const mut NOT_ALLOWED: u32 = 5;  // err: the 'mut' keyword is not allowed with 'const'

Note: the f32 and u32 are type declarations for a 32-bit floating point and 32-bit unsigned integer, respectively. Type definitions are discussed in a separate post.

Pre-release: open-dis-rust v0.1.0-alpha.4

Since v0.1.0-alpha.1, three versions have been released on crates.io. The Simulation Management Family and Simulation Management with Reliability Family PDUs have been fully implemented, and multiple security and quality tests have been performed and accounted for. This package is still very much a work in progress, but the December timeframe initially discussed is still valid for the v0.1.0 release. Just under 1/2 of the PDUs defined in the IEEE 1278.1 standard have been fully implemented; the SIMAN PDUs are arguably the most pertinent for generalized simulation management, and these have all been accounted for. With this still being in the alpha stages, the package is considered unstable and not fit for commercial or professional use at this time.

Before cutting the v0.1.0 official release, this package will go into beta for further testing and stability fixes. Once a release candidate is identified, this will go live on crates.io as a full release ready for general usage. I plan to maintain this package for as long as possible, and I will continue to provide bugfixes and security updates as needed.

Below is a copy of the markdown README provided with the source code that shows the current support status for all the PDUs defined in the DIS standard. The chart below will NOT be updated with future releases; all future changes to this chart can be viewed here on GitHub.

Supported PDUs

PDU Type Supported?
Acknowledge
AcknowledgeReliable
ActionRequest
ActionRequestReliable
ActionResponse
ActionResponseReliable
AggregateState
ArealObjectState
CollisionElastic
Collision
Comment
CommentReliable
CreateEntity
CreateEntityReliable
Data
DataQuery
DataQueryReliable
DataReliable
Designator
Detonation
ElectromagneticEmissions
EntityState
EntityStateUpdate
EnvironmentalProcess
EventReport
EventReportReliable
FastEntityState
Fire
GriddedData
IntercomControl
IntercomSignal
IsGroupOf
IsPartOf
LinearObjectState
Logistics
MinefieldData
MinefieldQuery
MinefieldResponseNack
MinefieldState
PointObjectState
Receiver
RecordQueryReliable
RemoveEntity
RemoveEntityReliable
RepairComplete
RepairResponse
ResupplyCancel
ResupplyOffer
ResupplyReceived
Sees
ServiceRequest
SetData
SetDataReliable
SetRecordReliable
Signal
StartResume
StartResumeReliable
StopFreeze
StopFreezeReliable
TransferControlRequest
Transmitter
UnderwaterAcoustic

Pre-release: open-dis-rust v0.1.0-alpha.1

The IEEE 1278.1 Distributed Interactive Simulation (DIS) standard is a collection of definitions and enumerations for a general-purpose messaging system for managing and maintaining distributed simulations. As is common practice with some software frameworks and standards, IEEE has just defined this standard and does not provide an official implementation. The Open DIS collection of software libraries has existed for several years now, having been developed by a third-party, non-IEEE-affiliated group. These libraries are implemented in C++, Java, Python, and a couple other mainstream languages, but I have come to find that these libraries are poorly maintained and incomplete. In fact, I have yet to find an open-source implementation of the IEEE 1278.1 standard that is complete and reasonably error-free.

As a solution to this issue, I have started development on an implementation of the DIS standard in a modern system-level programming language: Rust. The open-dis-rust crate is published on the Rust package manager website (Crates.io) and is currently in the pre-release stages. I will post changelogs and significant updates here as needed. Further information can be found on crates.io as well as its GitHub repository.

This is intended to be a complete, 100% adherent software implementation of the DIS standard. At the time of writing, about 1/7th of the Protocol Data Unit (PDU) messages defined in the standard have been implemented. The ETA for a full release is late November / early December. Throughout the development process, and even after full release, all issues and PRs are welcome to improve this library.