Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /branches/charisee/src/compiler/gen/opt/keywords.sml
ViewVC logotype

View of /branches/charisee/src/compiler/gen/opt/keywords.sml

Parent Directory Parent Directory | Revision Log Revision Log

Revision 2377 - (download) (annotate)
Mon Jun 3 19:41:56 2013 UTC (8 years, 3 months ago) by jhr
File size: 1650 byte(s)
  Create new branch for Charisee's Einstein stuff
(* keywords.sml
 * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.

structure Keywords : sig

    val idToken : string -> RulesTokens.token

  end = struct

    structure T = RulesTokens

  (* these are a subset of the operators; eventually, these will be either generated
   * by the IL generator tool or become part of the specification.
    val keywords = [

  (* create a keyword lookup table *)
    fun mkFind kws = let
	(* creates empty hashtable *)
          val tbl = AtomTable.mkTable (17, Fail "keywords")
          fun ins id =let
                val id=Atom.atom id
                  AtomTable.insert tbl (id, T.OPER id)
          val find = AtomTable.find tbl
          fun idToken id = let
                val id = Atom.atom id
                  case find id
                   of NONE => T.ID id (* does not find the kw *)
                    | SOME kw => kw (* finds the keywords*)
                  (* end case *)
            List.app ins kws; (* seed hash table with keywords *)

    val idToken = mkFind keywords


ViewVC Help
Powered by ViewVC 1.0.0