Skip to main content

Utilities

rascal-0.28.2
typepal-0.8.3

Synopsis

Some utility functions.

Description

TypePal provides some utility functions to address common scenarios.

== collectAndSolve

TModel collectAndSolve(Tree pt, TypePalConfig config = tconfig(), bool debug = false)

collectAndSolve implements the most simple type checking scenario without any customization. For a given parse tree pt:

  • Create a Collector and use it to create a TModel by applying collect to parse tree pt.
  • Create a Solver and solve the constraints in that TModel.
  • Return the extended TModel.

== getUseDef

rel[loc, loc] getUseDef(TModel tm)

Get all use-def relations in a given TModel. This may be used in an IDE for creating hyperlinks between use locations and definitions.

== getVocabulary

set[str] getVocabulary(TModel tm)

Get all defined names in a given TModel. This may be used in an IDE for text completion.

== getFacts

map[loc, AType] getFacts(TModel tm)

Get all the locations and their type in a given TModel.

== getMessages

list[Message] getMessages(TModel tm)

Get all the messages in a TModel (as added by the Solver).