-1

I'm working on an interpreter for some programming language.

The language uses many concepts, notably the concept of:

The interpreter for the language runs through at least two phases (happening in this order):

  1. compile time
  2. run time

Currently, in the module of the code base of the interpreter that implements the "run time" phase, I have a class named Value and a class named Type.

I am in the process of bringing the Type class back to the "compile time" phase, so that type checking is done at the "compile time" phase rather than at the "run time" phase (In other words I'm trying to recover from a bad design decision).

This implies that I also have to somehow bring a bent version of the Value class back to the "compile time" phase. More precisely, I have to create a new class that can:

  • generate a Value
  • infer the Type of the Value that can be generated

You could describe this concept as a "type-ascribed not-yet-evaluated value", or as a "value with a type", or as a "lazy value which type can be accessed without actually performing any run time operation".

[EDIT]

In other words, I'm trying to find a noun group for a value that is meant to be evaluated at run time, but which type is available at compile time without any computational cost.

[/EDIT]

So I'm now stuck, staring at my screen, looking for a miracle to find a way to name this concept. I'm looking for a noun group with the least amount of characters in it that represents this concept.

Here are some exemples of how the noun group would be used in an English sentence (as opposed to "in an identifier") like this:

As you see here [points a line of code], I can infer the type of an expression by using a [the noun group] without even evaluating the expression.

[The noun group] allows you to freely export some source code into as many different target languages as you'd like.

So far I came up with these names (each of them is followed by the reason it was dropped surrounded in parentheses):

class ValueThatHasAType { ... }

(It's really verbose, despite representing pretty well the idea)

class CompileTimeValueAndType { ... }

(It's really verbose, again, despite being really close to the concept I want)

class Symbol { ... }

(accordingly to thesaurus, "symbol" is a "letter, character, sign of written communication" (at the time I write this), but I'm trying to represent some sort of Value)

class TypedLazyValue { ... }

(This is not really adapted: A LegsArmsBodyHead isn't a Human. In other words, TypedLazyValue is too broad)

I'm not really expecting a single noun to exist for this (since I searched a lot on google and I couldn't find an acceptable term in the terminology used in the fields of compilation and interpretation), but if there is one, then I'd really be pleased to hear about it.

18
  • How would you use the adjective in an English sentence (as opposed to in an identifier)?
    – Lawrence
    Nov 6, 2019 at 4:25
  • @Lawrence I added two examples to clarify. Is my question clear enough now?
    – ljleb
    Nov 6, 2019 at 4:39
  • Why would the compilation phase need an adjective? Just so it could be made into a comparative or a superlative? Seems silly.
    – tchrist
    Nov 6, 2019 at 4:44
  • 1
    @Lawrence I was first asking for an adjective, then I realized I was after a noun, so I changed the content of the question but not the title. Should be fixed now
    – ljleb
    Nov 7, 2019 at 15:11
  • 1
    If an English language expert suggests a semantically suitable expression, how would you expect others in your domain to understand it correctly at first sight?
    – Kris
    Nov 7, 2019 at 15:25

2 Answers 2

2

You could call this a declaration reference.

If I understand you correctly, your language has lexical tokens that have a type property and a value property.

The token 123 for example has the type integer and a value that identifies a location in a table. As the compilation proceeds, the entry at that table location will change. Ultimately, it may contain a relative address in the memory of the execution system, which in turn may contain a binary coded number.

In the first stage of lexical analysis, there is no real way to identify the type, unless it has been previously declared.

The declaration can be explicit, as it is in C++, Java and similar arguments.

The declaration can also be implicit in various ways. For example, the assignment of a string constant to a variable can implicitly declare the variable to be a string. This may require more than a simple analysis however, since many languages allow upconversions, implicit casting and other programmer conveniences, which make anything other than a simple assignment difficult to parse.

In any case, if you want to determine the association between a lexical token and a type, some kind of association must have already been performed. At runtime this can sometimes be done by examining the value assigned at an earlier point in the execution. Prior to runtime, the association must be made by some kind of declaration. Hence the term declaration reference.

Edited to add:

More generally, you could refer to the declaration as a type binding, in the same way that an assignment is a value binding. However, declaration might be more clearly seen as something that happens at compile time.

0

This sounds kind of like a Constant, though that may be something different or I misunderstood your intent, or Invariant, or Fixed class.

1
  • My question was not clear when you answered. I added a rephrasing below the concept I'm looking for: a "value that is meant to be evaluated at run time, but which type is available at compile time without any computational cost".
    – ljleb
    Nov 7, 2019 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.