Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new AST type inference pass #20

Closed
ppaulweber opened this issue Mar 29, 2017 · 3 comments
Closed

new AST type inference pass #20

ppaulweber opened this issue Mar 29, 2017 · 3 comments

Comments

@ppaulweber
Copy link
Contributor

@ppaulweber
Copy link
Contributor Author

@emmanuel099 emmanuel099 removed their assignment Apr 3, 2017
ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue Apr 4, 2017
* fixed/renamed file name of pass
  - related to ref sealangdotorg/sea#20
ppaulweber added a commit to casm-lang/casmi that referenced this issue Apr 4, 2017
* fixed pass name
  - related to ref sealangdotorg/sea#20
ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue Apr 5, 2017
* cont'd with implementation
  - added first type check logic to the Ast::BasicType and
    Ast::FixedSizeType
  - related to ref sealangdotorg/sea#20
ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue Apr 5, 2017
* changed inheritance (base class) of Ast::Definition node from
  'Ast::Node' to 'Ast::TypedNode'
  - allows to set for all definitions in the type inference pass the
  'calculated' type, e.g. for enumeration definitions etc.
  - realted to sealangdotorg/sea#19
  - realted to sealangdotorg/sea#20
ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue Apr 5, 2017
* changed content of Namespace implementation from plain
  Ast::CallExpression::TargetType to a internal class 'Symbol', which
  contains besides the target type, the name, the definition and the
  artiy of a symbol
* updated the resolver pass
  - related to ref sealangdotorg/sea#22
* added new API function to the namespace implementation to lookup
  besides call expressions also basic types
  - needed and related to ref sealangdotorg/sea#20
ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue Apr 5, 2017
* cont'd by setting and calculating the correct 'libcasm_ir::Type' from
  'Ast::BasicType' and 'Ast::FixedSizeType'
  - related to sealangdotorg/sea#20
  - RESTRICTION: only a trivial 'static' Ast::ValueAtom is allowed for now
  - WIP: ranged integer is not implemented yet!
ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue Apr 6, 2017
* fixed missing expression operator dumping
  - related to ref sealangdotorg/sea#19
  - related to ref sealangdotorg/sea#20
ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue Apr 8, 2017
* if a CallExpr is relative, the symbol resolver forwards this problem
  further to the type inference pass
  - related to ref sealangdotorg/sea#22
  - related to ref sealangdotorg/sea#20
ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue Apr 11, 2017
* cont'd in 1. phase by deducing the correct base type from string to IR one
* added in 2. phase correct function and derived inference based on
  1. phase
  - still WIP
  - related to ref sealangdotorg/sea#20
ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue Apr 18, 2017
* added pre-order annotation and post-order inference to the
  TypeInferenceVisitor implementation
  - annotation performs a local and argument-based type-set construction
    from the provided libcasm_ir::Annotation information from
    corresponding operators (aka. instructions) or built-ins
  - inference selects the resulting 'result' type for a
    symbol/expression etc.
  - related to ref sealangdotorg/sea#20
@ppaulweber
Copy link
Contributor Author

@emmanuel099: latest commit casm-lang/libcasm-fe@3b1c3d3 is able to fully type inference the following example specification:

CASM init foo

enum Color = { Red, Green, Blue }
enum Angle = { Alpha, Beta, Gamma }

rule foo =
{
    let c : Color = .Red in // Color namespace from type of c
        skip

    let c = Color.Green in
        case c of // cases should use Color namespace of c
        {
            .Red: assert(false)
            .Green:
		case Angle.Beta of
		{
		    .Alpha: bar( 4 ) := bar( 10 + bar( 2 ) )
		    .Beta:  skip
		    .Gamma: skip		    
		}
            .Blue: assert(false)
        }

    bar( 1 ) := bar( bar( bar( 9 ) + 1 ) - 10 ) * 100

    program(self) := undef
}

[ static ]
function qux : -> Integer'[1..5] initially { 3 }

function bar : Integer -> Integer initially { qux -> qux } 

function mem : Bit'4 -> Bit'64

derived blub( a, b ) -> Integer = ( a + b )

rule lala( f ) =
{
    print( f )
    call foo
}

still there is a problem with the 'Agent' type of the 'program' function, but I'll fix this ASAP in the next commit

ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue Apr 19, 2017
* changed 'self' to be a internal 'function' element and not a 'builtin'
  IR element
* adopted the 'init' construction and 'initially' update of the
  'program' function
  - related to ref sealangdotorg/sea#19
  - related to ref sealangdotorg/sea#22
  - related to ref sealangdotorg/sea#20
ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue Apr 19, 2017
* moved self definition inside the specification node
  - related to sealangdotorg/sea#19
  - related to sealangdotorg/sea#22
  - related to sealangdotorg/sea#20
* generated grammar parser
ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue Apr 19, 2017
* added internal enumeration type mapping for "Agent" type
  - ATTENTION: this is currently OK, because we use single execution
    agent semantics, but later we have to insert here the defined domain
    of the agent type
  - related to ref sealangdotorg/sea#20
ppaulweber added a commit to casm-lang/libcasm-ir that referenced this issue Apr 19, 2017
* removed 'self' built in, due to the new AST-based definition and it is
  general a AST-only feature
  - see ref sealangdotorg/sea#19
  - see ref sealangdotorg/sea#20
  - see ref sealangdotorg/sea#22
ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue Apr 19, 2017
* added 'Void' to the basic type lookup table
  - needed for 'RuleRef' syntax to specify correct and full rule
    reference relation types
  - forwarding of indirect rule expression types to the upper node
  - related to ref sealangdotorg/sea#20
ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue Apr 19, 2017
* added 'RelationType' type inference to check the input types for this
  kind, allowed are 'RuleRef' and 'FuncRef'
  - related to ref sealangdotorg/sea#20
  - related to ref sealangdotorg/sea#28
ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue Apr 19, 2017
* added new internal checking 'assignment()' method facility to verify
  that assigning types from a left-hand-side (lhs) and a
  right-hand-side (rhs) TypedNode do equal
  - added also a 'UndefAtom' checking routine, which assigns the lhs
  type to the rhs type if this one equals the 'UndefAtom' and is still
  not typed
* fixed UpdateRule inference
* fixed LetRule inference
  - related to ref sealangdotorg/sea#20
ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue Apr 20, 2017
* added reference type checking and inference support
  - related to ref sealangdotorg/sea#20
  - related to ref sealangdotorg/sea#28
@ppaulweber
Copy link
Contributor Author

merged into #32

ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue Apr 28, 2017
* fixed annotation/inference logic
  - related to ref sealangdotorg/sea#20
ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue Apr 29, 2017
* fixed inference calculation of variable direct call expression calls
  - related to ref sealangdotorg/sea#20
ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue May 5, 2017
* fixed range type construction, due to new range type concept
  - related to ref sealangdotorg/sea#20
ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue May 7, 2017
* fixed logger integration in the type inference pass, due to an API change
  in the libstdhl::Logger implementation
  - see: sealangdotorg/libuse@84fe1df
  - related to ref sealangdotorg/sea#20
ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue May 16, 2017
* updated forward annotation for direct call expressions of rules,
  functions, and deriveds as well as we already did for built-ins
  - related to ref sealangdotorg/sea#20
ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue May 17, 2017
* improved inference argument type checking and resolving
  - related to ref sealangdotorg/sea#20
ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue May 17, 2017
* updated type inference pass to resolve variable types (e.g. Bit'n)
  with new libcasm-ir argument type selection lookup functionality
  introduced in the following commit:
  - casm-lang/libcasm-ir@fd1d0b7
  - related to ref sealangdotorg/sea#20
ppaulweber added a commit to casm-lang/libcasm-fe that referenced this issue May 18, 2017
* fixed type inference for conditional expressions etc.
  - realted to ref sealangdotorg/sea#20
* updated error codes
* added additional type check in the consistency check pass
@ppaulweber ppaulweber modified the milestones: prototype, release_auxentios Nov 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants