2018-07-14 01:55:11 +02:00
|
|
|
// Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
#ifndef FORTRAN_SEMANTICS_EXPRESSION_H_
|
|
|
|
#define FORTRAN_SEMANTICS_EXPRESSION_H_
|
|
|
|
|
|
|
|
#include "../evaluate/expression.h"
|
2018-08-31 22:28:21 +02:00
|
|
|
#include "../evaluate/type.h"
|
2018-07-14 01:55:11 +02:00
|
|
|
#include "../parser/parse-tree.h"
|
|
|
|
#include <optional>
|
|
|
|
|
|
|
|
namespace Fortran::semantics {
|
|
|
|
|
2018-08-20 18:29:08 +02:00
|
|
|
using MaybeExpr = std::optional<evaluate::Expr<evaluate::SomeType>>;
|
2018-08-13 22:33:31 +02:00
|
|
|
|
2018-08-31 22:28:21 +02:00
|
|
|
struct IntrinsicTypeDefaultKinds {
|
|
|
|
int defaultIntegerKind{evaluate::DefaultInteger::kind};
|
|
|
|
int defaultRealKind{evaluate::DefaultReal::kind};
|
2018-09-07 19:33:32 +02:00
|
|
|
int defaultDoublePrecisionKind{evaluate::DefaultDoublePrecision::kind};
|
|
|
|
int defaultQuadPrecisionKind{evaluate::DefaultDoublePrecision::kind};
|
2018-08-31 22:28:21 +02:00
|
|
|
int defaultCharacterKind{evaluate::DefaultCharacter::kind};
|
|
|
|
int defaultLogicalKind{evaluate::DefaultLogical::kind};
|
|
|
|
};
|
2018-07-14 01:55:11 +02:00
|
|
|
|
2018-09-12 20:20:30 +02:00
|
|
|
// Semantic analysis of one expression.
|
|
|
|
std::optional<evaluate::Expr<evaluate::SomeType>> AnalyzeExpr(
|
|
|
|
evaluate::FoldingContext &, const IntrinsicTypeDefaultKinds &,
|
|
|
|
const parser::Expr &);
|
2018-08-13 22:33:31 +02:00
|
|
|
|
2018-09-12 20:20:30 +02:00
|
|
|
// Semantic analysis of all expressions in a parse tree, which is
|
|
|
|
// decorated with typed representations for top-level expressions.
|
2018-09-07 19:33:32 +02:00
|
|
|
void AnalyzeExpressions(parser::Program &, evaluate::FoldingContext &,
|
2018-09-12 20:20:30 +02:00
|
|
|
const IntrinsicTypeDefaultKinds &);
|
2018-09-07 19:33:32 +02:00
|
|
|
|
2018-07-14 01:55:11 +02:00
|
|
|
} // namespace Fortran::semantics
|
|
|
|
#endif // FORTRAN_SEMANTICS_EXPRESSION_H_
|