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 /archive/mlsave.11/parse/first.sml
ViewVC logotype

View of /archive/mlsave.11/parse/first.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4054 - (download) (annotate)
Wed Feb 4 20:42:42 2015 UTC (4 years, 5 months ago) by dbm
File size: 2082 byte(s)
Initial import of archive (of early versions of sml/nj)
(* first.sml  -- FIRST sets of selected nonterminals *)

structure FirstSets = struct

structure Token = Token

local
  open Token Lex Basics EnvAccess 
in

fun firstApat() = case !nextToken
    of ID =>  lookFIX(!idValue) = NONfix
     | OP => true
     | IDDOT => true
     | INT => true 
     | REAL => true
     | STRING => true
     | WILD => true
     | LPAREN => true
     | LBRACE => true
     | LBRACKET => true
     | _    => false

fun firstAexp() = case !nextToken
    of ID =>   lookFIX(!idValue) = NONfix
     | OP => true
     | IDDOT => true
     | INT => true
     | REAL => true
     | STRING => true
     | HASH => true
     | LPAREN => true
     | LBRACE => true
     | LBRACKET => true
     | LET => true
     | _    => false

fun firstExp() = case !nextToken
    of IF => true
     | WHILE => true
     | CASE => true
     | RAISE => true
     | RAISEX => true
     | FN => true
     | _ => firstAexp()
     
val firstLdec = 
    fn VAL => true
     | FUN => true
     | TYPE => true
     | DATATYPE => true
     | ABSTYPE => true
     | EXCEPTION => true
     | EXCEPTIONX => true
     | OPEN => true
     | LOCAL => true
     | INFIX => true
     | INFIXR => true
     | NONFIX => true
     | OVERLOAD => true
     | _    => false

val firstSdec = 
    fn VAL => true
     | FUN => true
     | TYPE => true
     | DATATYPE => true
     | ABSTYPE => true
     | EXCEPTION => true
     | EXCEPTIONX => true
     | OPEN => true
     | LOCAL => true
     | INFIX => true
     | INFIXR => true
     | NONFIX => true
     | OVERLOAD => true
     | STRUCTURE => true
     | ABSTRACTION => true
     | _    => false

val firstTdec = 
    fn SIGNATURE => true
     | STRUCTURE => true
     | ABSTRACTION => true
     | Token.FUNCTOR => true
     | _    => false

val firstSpec =
    fn STRUCTURE => true
     | TYPE => true
     | DATATYPE => true
     | VAL => true
     | EXCEPTION => true
     | EXCEPTIONX => true
     | INFIX => true
     | INFIXR => true
     | NONFIX => true
     | OVERLOAD => true
     | _    => false

end (* local *)

end (* FirstSets *)


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