Virgil Language Philosophy

This page contains an overview of the philosophy that drives the development of the Virgil Programming Language for building robust software systems on embedded hardware platforms. The principles that have influenced Virgil's design are presented and explained briefly.

Language

Language influences the construction and conveyance of thoughts, both in spoken and written forms. In computer systems, the selection of programming language influences the design of systems and contributes to their flexibility, scalability, security, and overall architecture. One of Virgil's primary aims is to improve the quality of software systems for embedded systems through strong type safety and object-oriented principles. Advances in programming language expressiveness and static checking techniques have produced significant and measurable productivity gains for many application areas. However, much of these gains have not reached the development of embedded systems, microcontrollers in particular, which are still developed in low-level, unsafe languages such as C and C++. Just as the safety and elegant simplicity of Java coupled with the emerging Internet brought a renaissance in software development for many moving away from older languages, we believe a similar opportunity exists for the Virgil language in the embedded domain.

Philosophy

The philosophy of Virgil encompasses a number of design principles that influence the language's structure, semantics and usage. Virgil programs will often run as the lowest level of software, on devices with very limited memories where the visibility of execution needed for debugging and testing is limited. Each principle captures important considerations, many of which are unique to embedded systems where debugging is difficult and resource concerns are paramount.

  • Clean syntax for better readability and maintainability.
    Tweaking language syntax for consistency, readability, and expressive power can allow for more clear expression of the program with less mess. Simpler grammars make more efficient parsers and also lower the barriers to entry for analysis tools that work at the source code level.
  • Static types for documentation, verification, and analysis.
    Strong types identify common programming errors and thereby eliminating certain large classes of bugs. Static types allow the compiler to guarantee that such errors will never be encountered in the execution of the deployed system.
  • Whole-program static compilation.
    While separate compilation allows incremental builds for shorter development cycles, modular reasoning, and clean separation of libraries, it complicates application build systems and reduces opportunities for compiler optimizations. Virgil employs a whole-program static compilation strategy that allows sophisticated global optimizations without sacrificing modular reasoning.
  • Minimal runtime system.
    Virgil does not require a virtual machine or other heavyweight runtime systems, which are not suited for the smallest of embedded devices. Instead, Virgil programs are compiled to native code and can be run as the lowest level of software, on the bare hardware. Thus a Virgil program can easily run without an operating system, a scheduler, or a garbage collector.
  • Amenable to powerful static analysis.
    Some programming constructs or disciplines complicate compiler analyses used for verification or optimization. For example, in C, pointers into the stack and doubly indirect pointers can significantly complicate advanced optimizations and obscure the intention and side effects of a program. Virgil relies heavily on static verification techniques, and thus avoids many constructs that are potentially confusing or difficult to analyze.
  • Resource constraints are no longer an afterthought.
    While traditional development methods rely on non-standard compiler flags, linker switches, and conditional compilation and configuration techniques to optimize for space rather than performance, the Virgil compiler and tools are designed to prioritize size considerations and employ sophisticated optimizations to reduce resource usage. Current research in the Virgil compiler is exploring advanced techniques to find the best tradeoffs in optimization and best implementation techniques to achieve better resource utilization in constrained environments.