Package de.monticore.siunit.siunits
Class SIUnitsMill
java.lang.Object
de.monticore.siunit.siunits.SIUnitsMill
- Direct Known Subclasses:
SIUnitsMillForSIUnitLiterals,SIUnitsMillForSIUnitTypes4Computing,SIUnitsMillForSIUnitTypes4Math
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 SIUnitsFullPrettyPrinterprotected static SIUnitsMillprotected ISIUnitsGlobalScopeprotected ISIUnitsTypeDispatcher -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ISIUnitsArtifactScopeprotected ASTCelsiusFahrenheitBuilderprotected ISIUnitsGlobalScopeprotected SIUnitsTraverserprotected SIUnitsParser_parser()protected String_prettyPrint(de.monticore.ast.ASTNode node, boolean printComments) protected ISIUnitsScope_scope()protected SIUnitsScopesGenitorprotected SIUnitsScopesGenitorDelegatorprotected ASTSIUnitBuilderprotected ASTSIUnitDimensionlessBuilderprotected ASTSIUnitGroupPrimitiveBuilderprotected ASTSIUnitKindGroupWithExponentBuilderprotected ASTSIUnitPrimitiveBuilderprotected ASTSIUnitWithoutPrefixBuilderprotected ASTSIUnitWithPrefixBuilderprotected SIUnitsTraverserprotected ISIUnitsTypeDispatcherstatic ISIUnitsArtifactScopestatic ASTBasicDoubleLiteralBuilderstatic ASTBasicFloatLiteralBuilderstatic ASTBasicLongLiteralBuilderstatic ASTBooleanLiteralBuilderstatic ASTCelsiusFahrenheitBuilderstatic ASTCharLiteralBuilderstatic SIUnitsMillgetMill()static ISIUnitsGlobalScopestatic SIUnitsTraverserA traverser is the conceptual entry point for every action within the visitor infrastructure.static voidinit()Initializes a languages Mill.static voidstatic ASTNatLiteralBuilderstatic ASTNullLiteralBuilderstatic SIUnitsParserparser()Returns a new instance of this language's parser.static StringprettyPrint(de.monticore.ast.ASTNode node, boolean printComments) Uses the composed pretty printer to print an ASTNode of this languagestatic voidreset()static ISIUnitsScopescope()static SIUnitsScopesGenitorReturns a new ScopeGenitor.Returns a new ScopeGenitorDelegator.static ASTSignedNatLiteralBuilderstatic ASTSIUnitBuilderstatic ASTSIUnitPrimitiveBuilderstatic ASTSIUnitWithPrefixBuilderstatic ASTStringLiteralBuilderstatic SIUnitsTraverserA traverser is the conceptual entry point for every action within the visitor infrastructure.static ISIUnitsTypeDispatcher
-
Field Details
-
mill
-
fullPrettyPrinter
-
typeDispatcher
-
sIUnitsGlobalScope
-
-
Constructor Details
-
SIUnitsMill
protected SIUnitsMill()
-
-
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. -
sIUnitBuilder
-
_sIUnitBuilder
-
sIUnitPrimitiveBuilder
-
_sIUnitPrimitiveBuilder
-
sIUnitWithPrefixBuilder
-
_sIUnitWithPrefixBuilder
-
sIUnitWithoutPrefixBuilder
-
_sIUnitWithoutPrefixBuilder
-
celsiusFahrenheitBuilder
-
_celsiusFahrenheitBuilder
-
sIUnitDimensionlessBuilder
-
_sIUnitDimensionlessBuilder
-
sIUnitKindGroupWithExponentBuilder
-
_sIUnitKindGroupWithExponentBuilder
-
sIUnitGroupPrimitiveBuilder
-
_sIUnitGroupPrimitiveBuilder
-
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
-
parser
Returns a new instance of this language's parser. Respects grammar composition by means of the Mill pattern.- Returns:
- a new instance of this language's parser
-
_parser
-
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
-
initMe
-
reset
public static void reset()
-