Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /smlnj-lib/trunk/SExp/sexp.sml
ViewVC logotype

View of /smlnj-lib/trunk/SExp/sexp.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4685 - (download) (annotate)
Mon Aug 20 16:45:33 2018 UTC (9 months ago) by jhr
File size: 779 byte(s)
  Added SExp pretty printer, plus a bug fix
(* sexp.sml
 *
 * COPYRIGHT (c) 2011 The Fellowship of SML/NJ (http://www.smlnj.org)
 * All rights reserved.
 *
 * Author: Damon Wang (with modifications by John Reppy)
 *
 * This is the tree representation of a SExp data as produced/consumed
 * by the tree parser.
 *)

structure SExp =
  struct

    datatype value
      = SYMBOL of Atom.atom
      | LIST of value list
      | BOOL of bool
      | INT of IntInf.int
      | FLOAT of real
      | STRING of string

    fun same (SYMBOL a, SYMBOL b) = Atom.same (a, b)
      | same (LIST a, LIST b) = ListPair.allEq same (a, b)
      | same (BOOL a, BOOL b) = (a = b)
      | same (INT a, INT b) = (a = b)
      | same (FLOAT a, FLOAT b) = Real.==(a, b)
      | same (STRING a, STRING b) = (a = b)
      | same _ = false

  end

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0