Package net.hydromatic.morel.ast
Enum CoreBuilder
- java.lang.Object
-
- java.lang.Enum<CoreBuilder>
-
- net.hydromatic.morel.ast.CoreBuilder
-
- All Implemented Interfaces:
Serializable,Comparable<CoreBuilder>
public enum CoreBuilder extends Enum<CoreBuilder>
Builds parse tree nodes.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description coreThe singleton instance of the CORE builder.
-
Field Summary
Fields Modifier and Type Field Description private Core.WildcardPatboolWildcardPatprivate Core.LiteralfalseLiteralprivate Core.LiteraltrueLiteralprivate Core.LiteralPattruePat
-
Constructor Summary
Constructors Modifier Constructor Description privateCoreBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Core.Aggregateaggregate(Type type, Core.Exp aggregate, @Nullable Core.Exp argument)Core.ExpandAlso(TypeSystem typeSystem, Core.Exp a0, Core.Exp a1)Core.Applyapply(Pos pos, Type type, Core.Exp fn, Core.Exp arg)private Core.Expargs(Type paramType, Core.Exp[] args)Core.AsPatasPat(Type type, String name, int i, Core.Pat pat)Core.AsPatasPat(Type type, String name, NameGenerator nameGenerator, Core.Pat pat)Creates an AsPat with a given name, generating an ordinal to distinguish it from other declarations with the same name elsewhere in the program.Core.LiteralboolLiteral(boolean b)Creates abooleanliteral.private static Core.LiteralboolLiteral_(boolean b)Used only during initialization.private Core.Applycall(TypeSystem typeSystem, BuiltIn builtIn, Core.Exp... args)Calls a built-in function.private Core.Applycall(TypeSystem typeSystem, BuiltIn builtIn, Type type, Pos pos, Core.Exp... args)Calls a built-in function with one type parameter.Core.CasecaseOf(Type type, Core.Exp exp, Iterable<? extends Core.Match> matchList, Pos pos)Core.LiteralcharLiteral(char c)Creates acharliteral.Core.Con0Patcon0Pat(DataType type, String tyCon)Core.ConPatconPat(Type type, String tyCon, Core.Pat pat)Core.ConPatconsPat(Type type, String tyCon, Core.Pat pat)Core.DatatypeDecldatatypeDecl(Iterable<DataType> dataTypes)Core.Expelem(TypeSystem typeSystem, Core.Exp a0, Core.Exp a1)Core.Expequal(TypeSystem typeSystem, Core.Exp a0, Core.Exp a1)Core.Expfield(TypeSystem typeSystem, Core.Exp exp, int slot)Creates a reference to theslotth field of an expression, "#slot exp".Core.Fnfn(FnType type, Core.IdPat idPat, Core.Exp exp)Core.Fromfrom(ListType type, List<Core.FromStep> steps)Core.Fromfrom(TypeSystem typeSystem, List<Core.FromStep> steps)Derives the result type, then callsfrom(ListType, List).FromBuilderfromBuilder(TypeSystem typeSystem)Creates a builder that will create aCore.Frombut does not validate.FromBuilderfromBuilder(TypeSystem typeSystem, @Nullable Environment env)Creates a builder that will create aCore.From.(package private) static TypefromElementType(TypeSystem typeSystem, List<Core.FromStep> steps)Returns the element type of aCore.Fromwith the given steps.Core.LiteralfunctionLiteral(TypeSystem typeSystem, BuiltIn builtIn)Creates a function literal.Core.ExpgreaterThan(TypeSystem typeSystem, Core.Exp a0, Core.Exp a1)Core.Groupgroup(SortedMap<Core.IdPat,Core.Exp> groupExps, SortedMap<Core.IdPat,Core.Aggregate> aggregates)Core.Idid(Core.NamedPat idPat)Creates a reference to a value.Core.IdPatidPat(Type type, String name, int i)Creates an IdPat with a given name and ordinal.Core.IdPatidPat(Type type, String name, NameGenerator nameGenerator)Creates an IdPat with a given name, generating an ordinal to distinguish it from other declarations with the same name elsewhere in the program.Core.IdPatidPat(Type type, NameGenerator nameGenerator)Creates an IdPat with a system-generated unique name.Core.CaseifThenElse(Core.Exp condition, Core.Exp ifTrue, Core.Exp ifFalse)Core.ExpimplicitYieldExp(TypeSystem typeSystem, List<Core.FromStep> steps)Returns what would be the yield expression if we created aCore.Fromfrom the given steps.Core.LiteralintLiteral(BigDecimal value)Creates anintliteral.List<Binding>lastBindings(List<? extends Core.FromStep> steps)Core.ExplessThan(TypeSystem typeSystem, Core.Exp a0, Core.Exp a1)Core.Letlet(Core.ValDecl decl, Core.Exp exp)Core.Explist(TypeSystem typeSystem, Type elementType, List<Core.Exp> args)Creates a list.Core.ListPatlistPat(Type type, Iterable<? extends Core.Pat> args)Core.ListPatlistPat(Type type, Core.Pat... args)Core.ListPatlistPat(TypeSystem typeSystem, List<Core.Pat> args)Core.Literalliteral(PrimitiveType type, Object value)Creates a literal.Core.LiteralPatliteralPat(Op op, Type type, Comparable value)Core.Locallocal(DataType dataType, Core.Exp exp)Core.Matchmatch(Core.Pat pat, Core.Exp exp, Pos pos)Core.NonRecValDeclnonRecValDecl(Core.NamedPat pat, Core.Exp exp, Pos pos)Core.Exponly(TypeSystem typeSystem, Pos pos, Core.Exp a0)Core.Orderorder(List<Binding> bindings, Iterable<Core.OrderItem> orderItems)Core.OrderItemorderItem(Core.Exp exp, Ast.Direction direction)Core.ExporElse(TypeSystem typeSystem, Core.Exp a0, Core.Exp a1)Core.LiteralrealLiteral(Float value)Creates afloatliteral with a non-normal value.Core.LiteralrealLiteral(BigDecimal value)Creates afloatliteral.Core.Exprecord(TypeSystem typeSystem, Map<String,? extends Core.Exp> nameExps)Creates a record.Core.RecordPatrecordPat(RecordType type, List<? extends Core.Pat> args)Core.PatrecordPat(TypeSystem typeSystem, Set<String> argNames, List<Core.Pat> args)Core.RecordSelectorrecordSelector(FnType fnType, int slot)Core.RecordSelectorrecordSelector(TypeSystem typeSystem, RecordLikeType recordType, int slot)Core.RecordSelectorrecordSelector(TypeSystem typeSystem, RecordLikeType recordType, String fieldName)Core.RecValDeclrecValDecl(Iterable<? extends Core.NonRecValDecl> list)Core.Scanscan(Op op, List<Binding> bindings, Core.Pat pat, Core.Exp exp, Core.Exp condition)Core.LiteralstringLiteral(String value)Creates a string literal.Core.Tupletuple(RecordLikeType type, Iterable<? extends Core.Exp> args)Core.Tupletuple(RecordLikeType type, Core.Exp... args)Core.Tupletuple(TypeSystem typeSystem, @Nullable RecordLikeType type, Iterable<? extends Core.Exp> args)Astuple(RecordLikeType, Iterable), but derives type.Core.TuplePattuplePat(Type type, Iterable<? extends Core.Pat> args)Core.TuplePattuplePat(Type type, Core.Pat... args)Core.TuplePattuplePat(TypeSystem typeSystem, List<Core.Pat> args)Core.LiteralunitLiteral()Creates a unit literal.Core.LiteralvalueLiteral(Core.Exp exp, Object value)Creates a value literal.static CoreBuildervalueOf(String name)Returns the enum constant of this type with the specified name.static CoreBuilder[]values()Returns an array containing the constants of this enum type, in the order they are declared.Core.Wherewhere(List<Binding> bindings, Core.Exp exp)Core.WildcardPatwildcardPat(Type type)Core.Yieldyield_(List<Binding> bindings, Core.Exp exp)Core.Yieldyield_(TypeSystem typeSystem, Core.Exp exp)Derives bindings, then callsyield_(List, Core.Exp).
-
-
-
Enum Constant Detail
-
core
public static final CoreBuilder core
The singleton instance of the CORE builder. The short name is convenient for use via 'import static', but checkstyle does not approve.
-
-
Field Detail
-
truePat
private final Core.LiteralPat truePat
-
boolWildcardPat
private final Core.WildcardPat boolWildcardPat
-
trueLiteral
private final Core.Literal trueLiteral
-
falseLiteral
private final Core.Literal falseLiteral
-
-
Method Detail
-
values
public static CoreBuilder[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (CoreBuilder c : CoreBuilder.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CoreBuilder valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
literal
public Core.Literal literal(PrimitiveType type, Object value)
Creates a literal.
-
boolLiteral_
private static Core.Literal boolLiteral_(boolean b)
Used only during initialization.
-
boolLiteral
public Core.Literal boolLiteral(boolean b)
Creates abooleanliteral.
-
charLiteral
public Core.Literal charLiteral(char c)
Creates acharliteral.
-
intLiteral
public Core.Literal intLiteral(BigDecimal value)
Creates anintliteral.
-
realLiteral
public Core.Literal realLiteral(BigDecimal value)
Creates afloatliteral.
-
realLiteral
public Core.Literal realLiteral(Float value)
Creates afloatliteral with a non-normal value.
-
stringLiteral
public Core.Literal stringLiteral(String value)
Creates a string literal.
-
unitLiteral
public Core.Literal unitLiteral()
Creates a unit literal.
-
functionLiteral
public Core.Literal functionLiteral(TypeSystem typeSystem, BuiltIn builtIn)
Creates a function literal.
-
valueLiteral
public Core.Literal valueLiteral(Core.Exp exp, Object value)
Creates a value literal.
-
id
public Core.Id id(Core.NamedPat idPat)
Creates a reference to a value.
-
recordSelector
public Core.RecordSelector recordSelector(TypeSystem typeSystem, RecordLikeType recordType, String fieldName)
-
recordSelector
public Core.RecordSelector recordSelector(TypeSystem typeSystem, RecordLikeType recordType, int slot)
-
recordSelector
public Core.RecordSelector recordSelector(FnType fnType, int slot)
-
idPat
public Core.IdPat idPat(Type type, String name, int i)
Creates an IdPat with a given name and ordinal. You must ensure that the ordinal is unique for this name in this program.
-
idPat
public Core.IdPat idPat(Type type, NameGenerator nameGenerator)
Creates an IdPat with a system-generated unique name.
-
idPat
public Core.IdPat idPat(Type type, String name, NameGenerator nameGenerator)
Creates an IdPat with a given name, generating an ordinal to distinguish it from other declarations with the same name elsewhere in the program.
-
literalPat
public Core.LiteralPat literalPat(Op op, Type type, Comparable value)
-
wildcardPat
public Core.WildcardPat wildcardPat(Type type)
-
asPat
public Core.AsPat asPat(Type type, String name, int i, Core.Pat pat)
-
asPat
public Core.AsPat asPat(Type type, String name, NameGenerator nameGenerator, Core.Pat pat)
Creates an AsPat with a given name, generating an ordinal to distinguish it from other declarations with the same name elsewhere in the program.
-
consPat
public Core.ConPat consPat(Type type, String tyCon, Core.Pat pat)
-
conPat
public Core.ConPat conPat(Type type, String tyCon, Core.Pat pat)
-
con0Pat
public Core.Con0Pat con0Pat(DataType type, String tyCon)
-
tuplePat
public Core.TuplePat tuplePat(Type type, Iterable<? extends Core.Pat> args)
-
tuplePat
public Core.TuplePat tuplePat(Type type, Core.Pat... args)
-
tuplePat
public Core.TuplePat tuplePat(TypeSystem typeSystem, List<Core.Pat> args)
-
listPat
public Core.ListPat listPat(Type type, Iterable<? extends Core.Pat> args)
-
listPat
public Core.ListPat listPat(Type type, Core.Pat... args)
-
listPat
public Core.ListPat listPat(TypeSystem typeSystem, List<Core.Pat> args)
-
recordPat
public Core.RecordPat recordPat(RecordType type, List<? extends Core.Pat> args)
-
recordPat
public Core.Pat recordPat(TypeSystem typeSystem, Set<String> argNames, List<Core.Pat> args)
-
tuple
public Core.Tuple tuple(RecordLikeType type, Iterable<? extends Core.Exp> args)
-
tuple
public Core.Tuple tuple(RecordLikeType type, Core.Exp... args)
-
tuple
public Core.Tuple tuple(TypeSystem typeSystem, @Nullable RecordLikeType type, Iterable<? extends Core.Exp> args)
Astuple(RecordLikeType, Iterable), but derives type.If present,
typeserves as a template, dictating whether to produce a record or a tuple type, and if a record type, the field names. If not present, the result is a tuple type.
-
let
public Core.Let let(Core.ValDecl decl, Core.Exp exp)
-
local
public Core.Local local(DataType dataType, Core.Exp exp)
-
nonRecValDecl
public Core.NonRecValDecl nonRecValDecl(Core.NamedPat pat, Core.Exp exp, Pos pos)
-
recValDecl
public Core.RecValDecl recValDecl(Iterable<? extends Core.NonRecValDecl> list)
-
match
public Core.Match match(Core.Pat pat, Core.Exp exp, Pos pos)
-
caseOf
public Core.Case caseOf(Type type, Core.Exp exp, Iterable<? extends Core.Match> matchList, Pos pos)
-
from
public Core.From from(ListType type, List<Core.FromStep> steps)
-
from
public Core.From from(TypeSystem typeSystem, List<Core.FromStep> steps)
Derives the result type, then callsfrom(ListType, List).
-
fromElementType
static Type fromElementType(TypeSystem typeSystem, List<Core.FromStep> steps)
Returns the element type of aCore.Fromwith the given steps.
-
implicitYieldExp
public Core.Exp implicitYieldExp(TypeSystem typeSystem, List<Core.FromStep> steps)
-
lastBindings
public List<Binding> lastBindings(List<? extends Core.FromStep> steps)
-
fromBuilder
public FromBuilder fromBuilder(TypeSystem typeSystem, @Nullable Environment env)
Creates a builder that will create aCore.From.
-
fromBuilder
public FromBuilder fromBuilder(TypeSystem typeSystem)
Creates a builder that will create aCore.Frombut does not validate.
-
fn
public Core.Fn fn(FnType type, Core.IdPat idPat, Core.Exp exp)
-
apply
public Core.Apply apply(Pos pos, Type type, Core.Exp fn, Core.Exp arg)
-
datatypeDecl
public Core.DatatypeDecl datatypeDecl(Iterable<DataType> dataTypes)
-
scan
public Core.Scan scan(Op op, List<Binding> bindings, Core.Pat pat, Core.Exp exp, Core.Exp condition)
-
aggregate
public Core.Aggregate aggregate(Type type, Core.Exp aggregate, @Nullable Core.Exp argument)
-
order
public Core.Order order(List<Binding> bindings, Iterable<Core.OrderItem> orderItems)
-
orderItem
public Core.OrderItem orderItem(Core.Exp exp, Ast.Direction direction)
-
group
public Core.Group group(SortedMap<Core.IdPat,Core.Exp> groupExps, SortedMap<Core.IdPat,Core.Aggregate> aggregates)
-
where
public Core.Where where(List<Binding> bindings, Core.Exp exp)
-
yield_
public Core.Yield yield_(List<Binding> bindings, Core.Exp exp)
-
yield_
public Core.Yield yield_(TypeSystem typeSystem, Core.Exp exp)
Derives bindings, then callsyield_(List, Core.Exp).
-
field
public Core.Exp field(TypeSystem typeSystem, Core.Exp exp, int slot)
Creates a reference to theslotth field of an expression, "#slot exp". The expression's type must be record or tuple.
-
list
public Core.Exp list(TypeSystem typeSystem, Type elementType, List<Core.Exp> args)
Creates a list.
-
record
public Core.Exp record(TypeSystem typeSystem, Map<String,? extends Core.Exp> nameExps)
Creates a record.
-
call
private Core.Apply call(TypeSystem typeSystem, BuiltIn builtIn, Core.Exp... args)
Calls a built-in function.
-
call
private Core.Apply call(TypeSystem typeSystem, BuiltIn builtIn, Type type, Pos pos, Core.Exp... args)
Calls a built-in function with one type parameter.
-
equal
public Core.Exp equal(TypeSystem typeSystem, Core.Exp a0, Core.Exp a1)
-
lessThan
public Core.Exp lessThan(TypeSystem typeSystem, Core.Exp a0, Core.Exp a1)
-
greaterThan
public Core.Exp greaterThan(TypeSystem typeSystem, Core.Exp a0, Core.Exp a1)
-
elem
public Core.Exp elem(TypeSystem typeSystem, Core.Exp a0, Core.Exp a1)
-
andAlso
public Core.Exp andAlso(TypeSystem typeSystem, Core.Exp a0, Core.Exp a1)
-
orElse
public Core.Exp orElse(TypeSystem typeSystem, Core.Exp a0, Core.Exp a1)
-
only
public Core.Exp only(TypeSystem typeSystem, Pos pos, Core.Exp a0)
-
-