Articles tagged "gypsum"
An update on Gypsum and CodeSwitch
Published on 2018-04-22
Observant readers will notice I haven't written anything about Gypsum or CodeSwitch in a while. Work has reached manageable pace though, and I'm ready to start tinkering on side projects again. It's time for a change in direction: I plan to focus more on CodeSwitch and less on Gypsum.
Tagged:
codeswitch gypsum
Lambdas in Gypsum
Published on 2017-04-27
I've finally added a feature to Gypsum that I've wanted for a long time: lambdas. They're useful for defining short, compact functions that can be passed to other functions as callbacks. They're especially important for functional programming (map, filter, reduce, and friends).
Tagged:
compilers gypsum
Migrating to Bazel: Part 2
Published on 2017-03-16
Previously, I focused mostly on getting Python and C++ code to build. This time, I'll talk about adding support for building Gypsum packages. I'll also give a bit more background on the Skylark language and how Bazel deals with extensions.
Tagged:
bazel gypsum
Migrating to Bazel: Part 1
Published on 2017-02-21
Bazel is the open source version of Google's internal build system. Gypsum is a cross-language project, and wanted something that could easily be extended to work with Gypsum itself. Bazel was a natural choice.
Tagged:
bazel gypsum
Traits in Gypsum
Published on 2017-01-22
I'm happy to announce the launch of a major new language feature in Gypsum: traits. Traits are like interfaces in Java. They provide a form of multiple inheritance. When you define a trait, you create a new type and a set of methods that go with it, some of which may be abstract. Classes and other traits that inherit from a trait will inherit those methods.
Tagged:
compilers gypsum
Static and dynamic types in pattern matching
Published on 2016-12-28
Gypsum now supports pattern matching using both static and dynamic type information. In general, pattern matching involves checking at run-time whether a value has a given type. By incorporating static type information about the value being matched, we can perform some checks that wouldn't normally be safe to perform at run-time.
Tagged:
compilers gypsum
CodeSwitch API: native functions
Published on 2016-06-12
I've added the capability for CodeSwitch to call native functions written in C++. This means that when you write a package, part of it can be written in Gypsum, and part of it in C++. This is useful for implementing new low-level primitives, such as files and sockets.
Tagged:
codeswitch gypsum
CodeSwitch API improvements
Published on 2016-03-18
CodeSwitch is designed to be a library that can be embedded in any application. A good API is crucial. While I can't say that CodeSwitch's C++ API is completely stable yet, I think it's gotten to a pretty usable state.
Tagged:
codeswitch gypsum virtual-machines
Existential types in Gypsum
Published on 2016-02-04
Existential types allow you to express that you have an object with a known class, but you don't know what's inside it. For example, instead of having a list of strings, you have a list of "something". In technical terms, you have an instance of some paraterized class, but you don't know the type arguments. Existential types are similar to wildcard types in Java.
Tagged:
gypsum
Arrays in Gypsum
Published on 2016-01-26
In most languages (like C or Java), arrays are a primitive that stand on their own. You can build other data structures like array lists and hash maps out of them. In Gypsum, array elements can be integrated into any class. The normal class members come first in memory, then the array elements follow immediately.
Tagged:
gypsum
Pattern matching in Gypsum
Published on 2016-01-02
You might think of pattern matching as a switch statement on steroids. You examine a value using several patterns, then execute one an expression based on which of the patterns successfully matched.
Tagged:
gypsum
Importing symbols in Gypsum
Published on 2015-10-28
The import statement is one of several new language features I added to Gypsum this summer. Just like the import statement in Java, it makes definitions from another package available in the scope containing the import statement. Unlike Java, multiple definitions can be imported in the same statement. Definitions can also be renamed.
Tagged:
gypsum
Memory management in CodeSwitch
Published on 2015-09-12
CodeSwitch has its own garbage collected heap, which is used not only for objects allocated by interpreted code, but also for most internal data structures. In this article, I'll describe how the heap is built, how the garbage collector works, and how it tracks pointers to the heap from C++ code.
Tagged:
codeswitch garbage-collection gypsum virtual-machines
CodeSwitch bytecode and interpretation
Published on 2015-08-27
The interpreter is essentially a loop with a big switch-statement. In each iteration, it reads one instruction, switches on the opcode, branches to the appropriate case, then executes some code for that instruction.
Tagged:
codeswitch gypsum interpreter virtual-machines
Packages in Gypsum and CodeSwitch
Published on 2015-05-31
Packages are named bundles of related code. They make code easier to understand and distribute. Each package is compiled into a single file, and has a unique name, a version, and a list of dependencies.
Tagged:
codeswitch gypsum
Type parameter bounds and variance
Published on 2015-02-11
Type parameter bounds and variance provide a huge amount of flexibility and precision in the Gypsum type system. They let you handle many cases where you would normally have to fall back to casting and run-time type checking.
Tagged:
compilers gypsum
A weird problem in the Scala type system
Published on 2015-01-19
I've been trying to formalize the type system in Gypsum. There are two operations in particular that I want to put on a sound theoretical foundation.
Tagged:
compilers gypsum scala
Gypsum now has type parameters!
Published on 2014-12-09
Type parameters are also known as generics in other languages. They enable parametric polymorphism, providing abstraction over types for functions and classes.
Tagged:
compilers gypsum
Structure of the Gypsum compiler (part 3)
Published on 2014-09-27
In this article, I discuss closure conversion, class flattening, CodeSwitch bytecode, semantic analysis, and serialization.
Tagged:
compilers gypsum
Structure of the Gypsum compiler (part 2)
Published on 2014-09-12
In this article, I discuss the Gypsum intermediate representation, declaration analysis, inheritance analysis, and type analysis.
Tagged:
compilers gypsum
Structure of the Gypsum compiler (part 1)
Published on 2014-07-20
Gypsum is an experimental language, so the compiler is designed to be very flexible, easy to change and extend. The nice thing about side projects is that you can spend some extra time making sure the code is clean and elegant. You don't have to take on any technical debt to meet deadlines.
Tagged:
compilers gypsum
Introducing Gypsum
Published on 2014-07-06
Gypsum is a new compiled, statically-typed, object-oriented programming language. When the compiler is more complete, it will be functional as well. Its syntax is inspired by Python and Scala.
Tagged:
gypsum