home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / sml_nj / 93src.lha / src / basics / fixity.sml < prev    next >
Encoding:
Text File  |  1993-01-27  |  470 b   |  19 lines

  1. (* Copyright 1990 by AT&T Bell Laboratories *)
  2. (* fixity.sml *)
  3.  
  4. structure Fixity : FIXITY =
  5. struct
  6.  
  7.     datatype fixity = NONfix | INfix of (int*int)
  8.  
  9.   (* building fixities *)
  10.  
  11.     fun infixleft n = INfix (n+n, n+n+1)
  12.     fun infixright n = INfix (n+n+1, n+n)
  13.  
  14.     fun fixityToString NONfix = "nonfix "
  15.       | fixityToString (INfix (i,_)) =
  16.              (if i mod 2 = 0 then "infix " else "infixr ")^
  17.              (if i div 2 > 0 then makestring (i div 2)^" " else "")
  18. end
  19.