Extension: names (intern strings)


iskeyword(Name x)
  return x == "keyword";

Syntax & Semantics

This extension assumes the existence of a Name type, which is a typedef for char*. Names are like Lisp atoms: only one exists for any particular string constant, so they can be compared as pointers. The function Name nameof(char*) converts from an arbitrary string to a Name, allocating space for the new canonical string if necessary.

The extension allows the use of literal strings in contexts where Names are expected, e.g. in function calls or assignment to Name or comparisons. In such a context, the literal string is replaced by a reference to a new global variable corresponding to the Name of that string. These Names are initialized by a global object constructor when the binary is first loaded.


Not implemented.

Was implemented in earlier versions of rscc.

Extends both compile and compileifcond.