public Value evaluate(RuleEvaluator evaluator) {
        return accept(new LiteralVisitor<Value>() {
            @Override
            public Value visitBoolean(boolean b) {
                return Value.booleanValue(b);
            }

            @Override
            public Value visitString(Template value) {
                return Value.stringValue(value.accept(new TemplateVisitor<String>() {
                    @Override
                    public String visitStaticTemplate(String value) {
                        return value;
                    }

                    @Override
                    public String visitSingleDynamicTemplate(Expression value) {
                        return value.accept(evaluator).expectStringValue().getValue();
                    }

                    @Override
                    public String visitStaticElement(String value) {
                        return value;
                    }

                    @Override
                    public String visitDynamicElement(Expression value) {
                        return value.accept(evaluator).expectStringValue().getValue();
                    }

                    @Override
                    public String startMultipartTemplate() {
                        return "";
                    }

                    @Override
                    public String finishMultipartTemplate() {
                        return "";
                    }
                }).collect(Collectors.joining()));
            }

            @Override
            public Value visitRecord(Map<Identifier, Literal> members) {
                Map<Identifier, Value> types = new HashMap<>();
                for (Map.Entry<Identifier, Literal> entry : members.entrySet()) {
                    types.put(entry.getKey(), entry.getValue().evaluate(evaluator));
                }
                return Value.recordValue(types);
            }

            @Override
            public Value visitTuple(List<Literal> members) {
                List<Value> tuples = new ArrayList<>();
                for (Literal element : members) {
                    tuples.add(element.accept(evaluator));
                }
                return Value.arrayValue(tuples);
            }

            @Override
            public Value visitInteger(int value) {
                return Value.integerValue(value);
            }
        });
    }
@param evaluator the rule-set evaluator.
@return the resulting value.
smithy-rules-engine/src/main/java/software/amazon/smithy/rulesengine/language/syntax/expressions/literal/Literal.java