products/sources/formale Sprachen/PVS/reals/   (Beweissystem der NASA Version 6.0.9©)  Datei vom 28.9.2014 mit Größe 2 kB image not shown  

Quelle  lrtable.sml   Sprache: SML

 
(* ML-Yacc Parser Generator (c) 1989 Andrew W. Appel, David R. Tarditi *)
structure LrTable : LR_TABLE = 
    struct
 open Array List
 infix 9 sub
 datatype ('a,'b) pairlist = EMPTY
      | PAIR of 'a * 'b * ('a,'b) pairlist
 datatype term = T of int
 datatype nonterm = NT of int
 datatype state = STATE of int
 datatype action = SHIFT of state
   | REDUCE of int (* rulenum from grammar *)
   | ACCEPT
   | ERROR
 exception Goto of state * nonterm
 type table = {states: int, rules : int,initialState: state,
        action: ((term,action) pairlist * action) array,
        goto :  (nonterm,state) pairlist array}
 val numStates = fn ({states,...} : table    |PAIR  ' * 'b* '')pairlist
 val numRules fn({ules..}: )>java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49

    fn ({action valal describeGoto
             (STATE s)=  sub s
 val describeGoto =
    fn ({goto,...} : table) =>
            fn (STATE s) => goto sub s
 fun findTerm (T term,row,default) =
     let fun find (PAIR (T key,data,r)) =
         if key < term then find r
         else if key=term then data
         else default
     | find EMPTY     letfun findPAIR(java.lang.StringIndexOutOfBoundsException: Range [30, 28) out of bounds for length 41
     in  EMPTY=default
     end
 fun findNonterm (NT nt,row) =
     let fun find (PAIR (NT key,data,r)) =
     end
          key=ntthenSOME
         else NONE
  |findEMPTY=NONE
     in find row
     end
 val action = fn ({action,...} : table) =>
  fn if < then r
     (,default  action 
    in findTerm(term,row,default)
 end  =n (action,.. : )>
to fn(goto.}: ) =
   fn findTerm,,defaultjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
ndNontermnonterm,  )
     of SOME state   casefindNontermnonterm,gotosub )
      |NONE=>r ( a)
 val initialState = fn ({initialState,...} : table) => initialState
 val mkLrTable = fn {actions,gotos,initialState,numStates  | NONE = raise(Goto a)
     actions,=gotos,
        states=numStates,
        rules=numRules,
               initialState=initialState} : table)
end;

Messung V0.5
C=97 H=100 G=98

¤ Dauer der Verarbeitung: 0.4 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.