Package de.monticore.grammar.grammar
Class GrammarMill
java.lang.Object
de.monticore.grammar.grammar.GrammarMill
- Direct Known Subclasses:
GrammarMillForGrammar_WithConcepts
The mill is a factory for builders and other commonly used functions, such as parsers or visitors.
The mill was introduced to ensure compositionality of languages, while retaining reusability of functions developed for sublanguages.
Only one mill instance exists, even though in composed languages it is available under several static signatures.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected GrammarFullPrettyPrinterprotected IGrammarGlobalScopeprotected static GrammarMillprotected IGrammarTypeDispatcher -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ASTAbstractProdBuilderprotected ASTAdditionalAttributeBuilderprotected AdditionalAttributeSymbolBuilderprotected ASTAltBuilderprotected ASTAntlrOptionBuilderprotected IGrammarArtifactScopeprotected ASTASTRuleBuilderprotected ASTBlockBuilderprotected ASTCardBuilderprotected ASTClassProdBuilderprotected ASTConceptBuilderprotected ASTConstantBuilderprotected ASTConstantGroupBuilderprotected ASTEnumProdBuilderprotected ASTExternalProdBuilderprotected ASTFollowOptionBuilderprotected IGrammarGlobalScopeprotected ASTGrammarAnnotationBuilderprotected ASTGrammarMethodBuilderprotected ASTGrammarOptionBuilderprotected ASTGrammarReferenceBuilderprotected GrammarTraverserprotected ASTInterfaceProdBuilderprotected ASTKeyConstantBuilderprotected ASTKeyTerminalBuilderprotected ASTKeywordOptionBuilderprotected ASTKeywordRuleBuilderprotected ASTLexActionOrPredicateBuilderprotected ASTLexAltBuilderprotected ASTLexAnyCharBuilderprotected ASTLexBlockBuilderprotected ASTLexCharBuilderprotected ASTLexCharRangeBuilderprotected ASTLexNonTerminalBuilderprotected ASTLexOptionBuilderprotected ASTLexProdBuilderprotected ASTLexSimpleIterationBuilderprotected ASTLexStringBuilderprotected ASTMCGrammarBuilderprotected MCGrammarSymbolBuilderprotected MCGrammarSymbolSurrogateBuilderprotected ASTMethodParameterBuilderprotected ASTNonTerminalBuilderprotected ASTNonTerminalSeparatorBuilderprotected ASTOptionBuilderprotected ASTOptionValueBuilderprotected String_prettyPrint(de.monticore.ast.ASTNode node, boolean printComments) protected ProdSymbolBuilderprotected ProdSymbolSurrogateBuilderprotected ASTReplaceRuleBuilderprotected RuleComponentSymbolBuilderprotected RuleComponentSymbolSurrogateBuilderprotected ASTRuleReferenceBuilderprotected IGrammarScope_scope()protected ASTScopeRuleBuilderprotected GrammarScopesGenitorprotected GrammarScopesGenitorDelegatorprotected ASTSemanticpredicateOrActionBuilderprotected ASTSplitRuleBuilderprotected ASTStartRuleBuilderprotected ASTSymbolDefinitionBuilderprotected ASTSymbolRuleBuilderprotected ASTTerminalBuilderprotected ASTTokenConstantBuilderprotected ASTTokenTerminalBuilderprotected GrammarTraverserprotected IGrammarTypeDispatcherstatic ASTAbstractProdBuilderstatic ASTAltBuilderstatic ASTAntlrOptionBuilderstatic IGrammarArtifactScopestatic ASTASTRuleBuilderstatic ASTBasicDoubleLiteralBuilderstatic ASTBasicFloatLiteralBuilderstatic ASTBasicLongLiteralBuilderstatic ASTBlockBuilderstatic ASTBooleanLiteralBuilderstatic ASTCardBuilderstatic ASTCharLiteralBuilderstatic ASTClassProdBuilderstatic ASTConceptBuilderstatic ASTConstantBuilderstatic ASTConstantGroupBuilderstatic ASTEnumProdBuilderstatic ASTExternalProdBuilderstatic ASTFollowOptionBuilderstatic GrammarMillgetMill()static IGrammarGlobalScopestatic ASTGrammarAnnotationBuilderstatic ASTGrammarMethodBuilderstatic ASTGrammarOptionBuilderstatic ASTGrammarReferenceBuilderstatic GrammarTraverserA traverser is the conceptual entry point for every action within the visitor infrastructure.static voidinit()Initializes a languages Mill.static voidstatic ASTInterfaceProdBuilderstatic ASTKeyConstantBuilderstatic ASTKeyTerminalBuilderstatic ASTKeywordOptionBuilderstatic ASTKeywordRuleBuilderstatic ASTLexAltBuilderstatic ASTLexAnyCharBuilderstatic ASTLexBlockBuilderstatic ASTLexCharBuilderstatic ASTLexCharRangeBuilderstatic ASTLexNonTerminalBuilderstatic ASTLexOptionBuilderstatic ASTLexProdBuilderstatic ASTLexSimpleIterationBuilderstatic ASTLexStringBuilderstatic ASTMCBasicGenericTypeBuilderstatic ASTMCGrammarBuilderstatic MCGrammarSymbolBuilderstatic ASTMCImportStatementBuilderstatic ASTMCListTypeBuilderstatic ASTMCMapTypeBuilderstatic ASTMCOptionalTypeBuilderstatic ASTMCPrimitiveTypeBuilderstatic ASTMCQualifiedNameBuilderstatic ASTMCQualifiedTypeBuilderstatic ASTMCReturnTypeBuilderstatic ASTMCSetTypeBuilderstatic ASTMCVoidTypeBuilderstatic ASTMethodParameterBuilderstatic ASTNatLiteralBuilderstatic ASTNonTerminalBuilderstatic ASTNullLiteralBuilderstatic ASTOptionBuilderstatic ASTOptionValueBuilderstatic StringprettyPrint(de.monticore.ast.ASTNode node, boolean printComments) Uses the composed pretty printer to print an ASTNode of this languagestatic ProdSymbolBuilderstatic ProdSymbolSurrogateBuilderstatic ASTReplaceRuleBuilderstatic voidreset()static RuleComponentSymbolBuilderstatic ASTRuleReferenceBuilderstatic IGrammarScopescope()static ASTScopeRuleBuilderstatic GrammarScopesGenitorReturns a new ScopeGenitor.Returns a new ScopeGenitorDelegator.static ASTSignedNatLiteralBuilderstatic ASTSplitRuleBuilderstatic ASTStartRuleBuilderstatic ASTStringLiteralBuilderstatic ASTSymbolDefinitionBuilderstatic ASTSymbolRuleBuilderstatic ASTTerminalBuilderstatic ASTTokenConstantBuilderstatic ASTTokenTerminalBuilderstatic GrammarTraverserA traverser is the conceptual entry point for every action within the visitor infrastructure.static IGrammarTypeDispatcher
-
Field Details
-
mill
-
fullPrettyPrinter
-
typeDispatcher
-
grammarGlobalScope
-
-
Constructor Details
-
GrammarMill
protected GrammarMill()
-
-
Method Details
-
getMill
-
init
public static void init()Initializes a languages Mill. This will also initialize the Mills of all languages it depends on. This ensures that all objects of this mill, such as builders, traversers, scopes, ..., deliver the element of the correct language. -
mCGrammarBuilder
-
_mCGrammarBuilder
-
grammarReferenceBuilder
-
_grammarReferenceBuilder
-
grammarOptionBuilder
-
_grammarOptionBuilder
-
followOptionBuilder
-
_followOptionBuilder
-
antlrOptionBuilder
-
_antlrOptionBuilder
-
keywordOptionBuilder
-
_keywordOptionBuilder
-
startRuleBuilder
-
_startRuleBuilder
-
grammarAnnotationBuilder
-
_grammarAnnotationBuilder
-
lexProdBuilder
-
_lexProdBuilder
-
enumProdBuilder
-
_enumProdBuilder
-
externalProdBuilder
-
_externalProdBuilder
-
interfaceProdBuilder
-
_interfaceProdBuilder
-
abstractProdBuilder
-
_abstractProdBuilder
-
classProdBuilder
-
_classProdBuilder
-
cardBuilder
-
_cardBuilder
-
ruleReferenceBuilder
-
_ruleReferenceBuilder
-
altBuilder
-
_altBuilder
-
nonTerminalSeparatorBuilder
-
_nonTerminalSeparatorBuilder
-
blockBuilder
-
_blockBuilder
-
optionBuilder
-
_optionBuilder
-
optionValueBuilder
-
_optionValueBuilder
-
nonTerminalBuilder
-
_nonTerminalBuilder
-
terminalBuilder
-
_terminalBuilder
-
keyTerminalBuilder
-
_keyTerminalBuilder
-
tokenTerminalBuilder
-
_tokenTerminalBuilder
-
tokenConstantBuilder
-
_tokenConstantBuilder
-
keyConstantBuilder
-
_keyConstantBuilder
-
constantBuilder
-
_constantBuilder
-
constantGroupBuilder
-
_constantGroupBuilder
-
semanticpredicateOrActionBuilder
-
_semanticpredicateOrActionBuilder
-
conceptBuilder
-
_conceptBuilder
-
splitRuleBuilder
-
_splitRuleBuilder
-
keywordRuleBuilder
-
_keywordRuleBuilder
-
replaceRuleBuilder
-
_replaceRuleBuilder
-
aSTRuleBuilder
-
_aSTRuleBuilder
-
grammarMethodBuilder
-
_grammarMethodBuilder
-
methodParameterBuilder
-
_methodParameterBuilder
-
additionalAttributeBuilder
-
_additionalAttributeBuilder
-
lexAltBuilder
-
_lexAltBuilder
-
lexBlockBuilder
-
_lexBlockBuilder
-
lexCharRangeBuilder
-
_lexCharRangeBuilder
-
lexCharBuilder
-
_lexCharBuilder
-
lexAnyCharBuilder
-
_lexAnyCharBuilder
-
lexStringBuilder
-
_lexStringBuilder
-
lexActionOrPredicateBuilder
-
_lexActionOrPredicateBuilder
-
lexNonTerminalBuilder
-
_lexNonTerminalBuilder
-
lexSimpleIterationBuilder
-
_lexSimpleIterationBuilder
-
lexOptionBuilder
-
_lexOptionBuilder
-
symbolDefinitionBuilder
-
_symbolDefinitionBuilder
-
symbolRuleBuilder
-
_symbolRuleBuilder
-
scopeRuleBuilder
-
_scopeRuleBuilder
-
mCGrammarSymbolBuilder
-
_mCGrammarSymbolBuilder
-
additionalAttributeSymbolBuilder
-
_additionalAttributeSymbolBuilder
-
prodSymbolBuilder
-
_prodSymbolBuilder
-
ruleComponentSymbolBuilder
-
_ruleComponentSymbolBuilder
-
mCGrammarSymbolSurrogateBuilder
-
_mCGrammarSymbolSurrogateBuilder
-
additionalAttributeSymbolSurrogateBuilder
-
_additionalAttributeSymbolSurrogateBuilder
-
prodSymbolSurrogateBuilder
-
_prodSymbolSurrogateBuilder
-
ruleComponentSymbolSurrogateBuilder
-
_ruleComponentSymbolSurrogateBuilder
-
prettyPrint
Uses the composed pretty printer to print an ASTNode of this language- Parameters:
node- The ASTNode to be printedprintComments- Whether comments should be printed- Returns:
- The pretty printer output
-
_prettyPrint
-
typeDispatcher
-
_typeDispatcher
-
traverser
A traverser is the conceptual entry point for every action within the visitor infrastructure. Visitors may be added, which contain the implementations for the visit and endVisit methods. Handlers may be added to modify the default traversal strategy. Each traverser retains their traversed elements to avoid duplicate traversal, possibly requiringITraverser.clearTraversedElements()to be called in case of re-useinheritanceTraverser()should be preferred over normal traverser, as they further enable language composition.- Returns:
- a new instance of this language's traverser
-
_traverser
-
inheritanceTraverser
A traverser is the conceptual entry point for every action within the visitor infrastructure. Visitors may be added, which contain the implementations for the visit and endVisit methods. Handlers may be added to modify the default traversal strategy. Each traverser retains their traversed elements to avoid duplicate traversal, possibly requiringITraverser.clearTraversedElements()to be called in case of re-use Inheritance Traverser should be preferred over default ones, as they further enable language composition.- Returns:
- a new instance of this language's inheritance traverser
-
_inheritanceTraverser
-
globalScope
-
_globalScope
-
artifactScope
-
_artifactScope
-
scope
-
_scope
-
scopesGenitor
Returns a new ScopeGenitor. ScopeGenitors are responsible for creating the scope structure of artifacts of only this language and linking it with the AST nodes. Note: ScopeGenitors do NOT delegate to elements of composed languages which is why you are most likely looking forscopesGenitorDelegator().- Returns:
- a new instance of this language's scope genitor
-
_scopesGenitor
-
scopesGenitorDelegator
Returns a new ScopeGenitorDelegator. Delegates to the ScopeGenitors of composed languages, used for instantiating symbol tables in the context of language composition See the delegators #createFromAST method.- Returns:
- a new instance of this language's scope genitor delegator
-
_scopesGenitorDelegator
-
nullLiteralBuilder
-
booleanLiteralBuilder
-
charLiteralBuilder
-
stringLiteralBuilder
-
natLiteralBuilder
-
signedNatLiteralBuilder
-
basicLongLiteralBuilder
-
signedBasicLongLiteralBuilder
-
basicFloatLiteralBuilder
-
signedBasicFloatLiteralBuilder
-
basicDoubleLiteralBuilder
-
signedBasicDoubleLiteralBuilder
-
mCBasicGenericTypeBuilder
-
mCCustomTypeArgumentBuilder
-
mCListTypeBuilder
-
mCOptionalTypeBuilder
-
mCMapTypeBuilder
-
mCSetTypeBuilder
-
mCBasicTypeArgumentBuilder
-
mCPrimitiveTypeArgumentBuilder
-
mCQualifiedNameBuilder
-
mCPackageDeclarationBuilder
-
mCImportStatementBuilder
-
mCPrimitiveTypeBuilder
-
mCQualifiedTypeBuilder
-
mCReturnTypeBuilder
-
mCVoidTypeBuilder
-
initMe
-
reset
public static void reset()
-