Class LispLanguage

  • Direct Known Subclasses:
    Scheme

    public abstract class LispLanguage
    extends Language
    Language sub-class for Lisp-like languages (including Scheme).
    • Constructor Detail

      • LispLanguage

        public LispLanguage()
    • Method Detail

      • createReadTable

        public abstract ReadTable createReadTable()
        Create a fresh ReadTable appropriate for this language.
      • resolve

        public void resolve​(Compilation comp)
        Resolve names and other post-parsing processing.
        Overrides:
        resolve in class Language
      • defSntxStFld

        protected void defSntxStFld​(String name,
                                    String cname,
                                    String fname)
        Declare in the current Environment a Syntax bound to a static field.
        Parameters:
        name - the procedure's source-level name.
        cname - the name of the class containing the field.
        fname - the name of the field, which should be a static final field whose type extends kawa.lang.Syntax.
      • defSntxStFld

        protected void defSntxStFld​(String name,
                                    String cname)
      • keywordsAreSelfEvaluating

        public boolean keywordsAreSelfEvaluating()
        Are keywords self-evaluating? True in CommonLisp. Used to be true for Scheme also, but now in Scheme literal keywords should only be used for keyword arguments; if you want a Keyword value if should be quoted.
        Returns:
        true if we should treat keywords as self-evaluating.
      • selfEvaluatingSymbol

        public boolean selfEvaluatingSymbol​(Object obj)
      • langSymbolToSymbol

        public static Symbol langSymbolToSymbol​(Object sym)
        Convert the Language's idea of a symbol to a gnu.mapping.Symbol.
      • fromLangSymbol

        protected Symbol fromLangSymbol​(Object sym)
      • getPackageStyleType

        public Type getPackageStyleType​(String name)
        Try to get a type of the form lang:type. E.g. elisp:buffer.
        Parameters:
        name - The package-style type name as a string.
        Returns:
        null if no such type could be found, or the corresponding Type.
      • decodeArrayType

        public static Type decodeArrayType​(String name)
      • getNamedType

        public Type getNamedType​(String name)
        Description copied from class: Language
        Get the corresponding Type for a given name. This is currently used as a hook in the conversion of type designators to types. LispLanguage uses it to check for package style type designators such as emacs:buffer, and CommonLisp uses it to check for a type designator "boolean", so that is can return the appropriate boolean type. This is a bit over-specialised, but it beats actually overriding getTypeFor(String) in LispLanguage, CommonLisp just for these minor changes... FIXME!
        Overrides:
        getNamedType in class Language
        Parameters:
        name - The name of a type to search for.
        Returns:
        The corresponding Type if a suitable one can be found, otherwise null.
      • getTypeFor

        public Type getTypeFor​(Object spec,
                               boolean lenient)
        Description copied from class: Language
        Convert a "type value" to a Type. This is used to process types from source code. Normally, an identifier that resolves to a class name should resolve to the raw ClassType, rather than a language specific class (which might e.g. use a different constructor). These may be exceptions: specifically, given java.lang.String, we do want to use language-specific conversion to String.
        Overrides:
        getTypeFor in class Language