PreviousUpNext

15.4.545  src/lib/compiler/front/basics/map/fixity.pkg

## fixity.pkg 

# Compiled by:
#     src/lib/compiler/front/basics/basics.sublib

api Fixity {

    Fixity = NONFIX
           | INFIX  ((Int,Int));

    infixleft:       Int -> Fixity;
    infixright:      Int -> Fixity;

    fixity_to_string:  Fixity -> String;

}; #  Api Fixity 


package   fixity
: (weak)  Fixity                                # Fixity        is from   src/lib/compiler/front/basics/map/fixity.pkg
{
    Fixity                                      # 'Fixity' is the referent for   symbolmapstack_entry::Symbolmapstack_Entry.NAMED_FIXITY
      #
      = NONFIX
      | INFIX  (Int, Int);                      # Precedence. The two are identical except for low bit, which encodes associativity. 

    #  Building fixities 

    fun infixleft  n   =   INFIX (n+n, n+n+1);
    fun infixright n   =   INFIX (n+n+1, n+n);

    fun fixity_to_string NONFIX => "nonfix ";

        fixity_to_string (INFIX (i, _))
            =>
            if   (i % 2 == 0   )   "infix ";                       else   "infixr ";fi
            +
            if   (i / 2 > 0    )   int::to_string (i / 2) + " ";   else   "";       fi;
    end;

}; #  package fixity 



## Copyright 1996 by AT&T Bell Laboratories 
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext