egranata / krakatau

Krakatau: a stack based virtual machine
Apache License 2.0
12 stars 0 forks source link

Enumerated types #18

Open egranata opened 5 years ago

egranata commented 5 years ago

Add support for enumerations, i.e. types whose value can be one of a closed set of symbolic constants

egranata commented 5 years ago

One possible implementation is to do basically what C does: the atoms are just a nice placeholder over a numeric value. Keep a table of (string -> number), and carry around a pair of (table, string) for each value of the enumeration.