Package org.ek9lang.compiler
Class CompilableProgram
java.lang.Object
org.ek9lang.compiler.CompilableProgram
- All Implemented Interfaces:
Serializable
Represents the whole program(s) that the developer is attempting to create.
This is the main route in and holds module symbol tables and references to the compilable source code
and the resulting parse trees.
So access to this object needs to be tightly controlled. This should be done via the SharedThreadContext object.
This also acts as a scope to enable symbols to be defined and resolved (across parsed modules if needs be).
No longer using a global symbol table, but will use 'implicit' modules a bit like java does.
So, will use module name 'org.ek9.lang' as the main implicit module to define build in types/symbols.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(ParsedModule parsedModule) Add in a newly parsed module to the list of parsed modules.getOriginalReferenceLocation
(String moduleName, SymbolSearch search) Locates the token when the first reference was established.For a specific source the ParsedModule is returned.Provides a list of all the module names in the program.getParsedModules
(String moduleName) Provide read only access to the list of modules for a particular moduleName.void
remove
(ParsedModule parsedModule) If some source has been altered, then its corresponding parsedModule must be removed.Resolve some symbol via a fully qualified search.Search in the implicit ek9 module namespaces of: org.ek9.lang etc.resolveFromModule
(String moduleName, SymbolSearch search) A package name (moduleName) can actually have multiple parsedModules (i.e.resolveOrDefine
(PossibleGenericSymbol possibleGenericSymbol) When using generic types, the parameterised type goes into the same module namespace as the Generic Type.resolveReferenceFromModule
(String moduleName, SymbolSearch search) Check the existing set of references in the moduleName.void
setCompilationData
(CompilationData compilationData) void
setEk9Types
(Ek9Types ek9Types)
-
Constructor Details
-
CompilableProgram
public CompilableProgram()
-
-
Method Details
-
getParsedModuleForCompilableSource
For a specific source the ParsedModule is returned. -
getEk9Types
-
getCompilationData
-
setCompilationData
-
setEk9Types
-
add
Add in a newly parsed module to the list of parsed modules. Classify in the same set under the same module name.- Parameters:
parsedModule
- The new parsed module to add in.
-
remove
If some source has been altered, then its corresponding parsedModule must be removed. Once it has, then been parsed it can be added back in.- Parameters:
parsedModule
- The existing parsed module to be removed.
-
getParsedModules
Provide read only access to the list of modules for a particular moduleName. Returns an empty list of the module name cannot be located. -
getParsedModuleNames
Provides a list of all the module names in the program. This can be very long. -
resolveByFullyQualifiedSearch
Resolve some symbol via a fully qualified search. -
resolveOrDefine
When using generic types, the parameterised type goes into the same module namespace as the Generic Type. i.e. org.ek9.lang::List of some.mod.area::Thing would be given a fully qualified name like org.ek9.lang::_List_SOMEDIGEST_OF_FULLY_QULIFIED_NAMES. So once a List of String has been defined it can be used everywhere as it will be in the org.ek9.lang module. -
resolveFromModule
A package name (moduleName) can actually have multiple parsedModules (i.e. a module can be made from multiple source files, each of which has its own parsed module). But they are all part of the same namespace (package/module). This method finds the appropriate set of parsed modules (if that module name exists) and then checks each of the modules to see if the search can be resolved. It returns the first resolution or Optional empty if it cannot be resolved. -
getOriginalReferenceLocation
Locates the token when the first reference was established. -
resolveReferenceFromModule
Check the existing set of references in the moduleName. So that means as there are multiple sources per module it is necessary to check in each. -
resolveFromImplicitScopes
Search in the implicit ek9 module namespaces of: org.ek9.lang etc.
-