language-oberon-0.1.1: Parser and pretty-printer for the Oberon programming language

Safe HaskellNone
LanguageHaskell2010

Language.Oberon.Resolver

Description

This module exports functions for resolving the syntactic ambiguities in a parsed module. For example, an Oberon expression foo(bar) may be a call to function foo with a parameter bar, or it may be type guard on variable foo casting it to type bar.

Synopsis

Documentation

data Error Source #

All possible resultion errors

Instances

type Predefined = Map Ident (Validation (NonEmpty Error) (DeclarationRHS Identity)) Source #

A set of Predefined declarations.

predefined :: Predefined Source #

The set of Predefined types and procedures defined in the Oberon Language Report.

predefined2 :: Predefined Source #

The set of Predefined types and procedures defined in the Oberon-2 Language Report.

resolveModule :: Predefined -> Map Ident (Validation (NonEmpty Error) (Module Identity)) -> Module Ambiguous -> Validation (NonEmpty Error) (Module Identity) Source #

Eliminate the ambiguites in the parsed syntax tree of a single module. The first argument is a set of Predefined declarations, such as predefined or predefined2. The second is a mapping of imported module names to their already resolved syntax trees.

resolveModules :: Predefined -> Map Ident (Module Ambiguous) -> Validation (NonEmpty (Ident, NonEmpty Error)) (Map Ident (Module Identity)) Source #

Eliminate the ambiguites in the given map of module names to their parsed syntax trees. The first argument is a set of Predefined declarations, such as predefined or predefined2.