Defining primitive types for custom language, with metadata?

I'd like to create a list of primitive types that users of my language have access to.   I can't use enum (or I don't want to), because I want to have some additional metadata available for use/analysis.

For example, I have 3 "kinds" of primitives, "signed integral" "unsigned integral" and "floating point"

For the integral kinds, it can have sizes of 8, 16, 32,  For the floating point kinds, it can have 32 and 64

I'd like to have the names be determined automatically (uint8, float32, etc...)

I have a "Type" concept, and a TypeReference concept.  I'll have other Types (user-defined types, and some library types).


I'm not quite sure how to create this.  I'd like the language user to easily type the primitive name to get a reference to that type.


Please sign in to leave a comment.