/* (c) https://github.com/MontiCore/monticore */ package de.monticore.symbols; /* This is a MontiCore stable grammar. * Adaptations -- if any -- are conservative. */ import de.monticore.*; /** * The grammar introduces reusable symbols for * Types (of all kinds), * Functions, * Variables and * TypeVariables * * The symbols are of general nature and do not precluse (and thus also * not assist) static, private or other specialities. * Extensions of these symbols can be found in the subgrammar * OOSymbols that add such specific elements. * * This grammar is used to generate an abstract syntax * (and especially symboltable infrastructure) only. * These AST-classes are then used to store typing information * in the SymbolTable. * * These symbols can be used in other grammars, when actual implementations * of these symbols become available or these symbols need to be imported * from other artifacts. * */ component grammar BasicSymbols extends de.monticore.MCBasics { /*=================================================================*/ /** * A diagram has a name and carries a varying set of symbols . * * It may also contain potentially variables (record elements, fields, * attributes, etc.) or associated functions (the OO methods). * These are represented as Symbols in the body of the type * and thus made available through the associated scope object. */ interface symbol Diagram = Name; /*=================================================================*/ /** * A type has a name and possible supertypes. * * It may also contain potentially variables (record elements, fields, * attributes, etc.) or associated functions (the OO methods). * These are represented as Symbols in the body of the type * and thus made available through the associated scope object. */ interface scope symbol Type = Name ; symbolrule Type = superTypes: de.monticore.types.check.SymTypeExpression* ; /*=================================================================*/ /** * A typeVar is used as unbound argument in generic types, * e.g. Map has a type variable T * TypeVars are instantiated with concrete types upon use. */ interface symbol TypeVar extends Type = Name ; /*=================================================================*/ /** * A Variable (Local variable, Java Attribute, etc.) has a type */ interface symbol Variable = Name ; symbolrule Variable = type: de.monticore.types.check.SymTypeExpression isReadOnly: boolean ; /*=================================================================*/ /** * A function is defined by its signature. * A signature consists of a return type, and a list of parameters. * The parameters are stored as variable symbols (in an associated scope). */ interface scope symbol Function = Name ; symbolrule Function = isElliptic: boolean type: de.monticore.types.check.SymTypeExpression ; }