// Implementation file for parser generated by fsyacc
module internal FsLexYacc.FsYacc.Parser
#nowarn "64";; // turn off warnings that type variables used in production annotations are instantiated to concrete type
open Internal.Utilities.Text.Lexing
open Internal.Utilities.Text.Parsing.ParseHelpers
# 1 "fsyaccpars.fsy"

(* (c) Microsoft Corporation 2005-2008.  *)

// FsLexYacc.FsYacc.Parser

open FsLexYacc.FsYacc
open FsLexYacc.FsYacc.AST

#nowarn "62" // This construct is for ML compatibility


# 18 "fsyaccpars.fs"
// This type is the type of tokens accepted by the parser
type token = 
  | TOKEN of (string option)
  | TYPE of (string)
  | BAR
  | PERCENT_PERCENT
  | START
  | LEFT
  | RIGHT
  | NONASSOC
  | LESS
  | GREATER
  | COLON
  | PREC
  | SEMI
  | EOF
  | ERROR
  | HEADER of (AST.Code)
  | CODE of (AST.Code)
  | IDENT of (string)
// This type is used to give symbolic names to token indexes, useful for error messages
type tokenId = 
    | TOKEN_TOKEN
    | TOKEN_TYPE
    | TOKEN_BAR
    | TOKEN_PERCENT_PERCENT
    | TOKEN_START
    | TOKEN_LEFT
    | TOKEN_RIGHT
    | TOKEN_NONASSOC
    | TOKEN_LESS
    | TOKEN_GREATER
    | TOKEN_COLON
    | TOKEN_PREC
    | TOKEN_SEMI
    | TOKEN_EOF
    | TOKEN_ERROR
    | TOKEN_HEADER
    | TOKEN_CODE
    | TOKEN_IDENT
    | TOKEN_end_of_input
    | TOKEN_error
// This type is used to give symbolic names to token indexes, useful for error messages
type nonTerminalId = 
    | NONTERM__startspec
    | NONTERM_spec
    | NONTERM_headeropt
    | NONTERM_decls
    | NONTERM_decl
    | NONTERM_idents
    | NONTERM_rules
    | NONTERM_rule
    | NONTERM_optbar
    | NONTERM_optsemi
    | NONTERM_clauses
    | NONTERM_clause
    | NONTERM_syms
    | NONTERM_optprec

// This function maps tokens to integer indexes
let tagOfToken (t:token) = 
  match t with
  | TOKEN _ -> 0 
  | TYPE _ -> 1 
  | BAR  -> 2 
  | PERCENT_PERCENT  -> 3 
  | START  -> 4 
  | LEFT  -> 5 
  | RIGHT  -> 6 
  | NONASSOC  -> 7 
  | LESS  -> 8 
  | GREATER  -> 9 
  | COLON  -> 10 
  | PREC  -> 11 
  | SEMI  -> 12 
  | EOF  -> 13 
  | ERROR  -> 14 
  | HEADER _ -> 15 
  | CODE _ -> 16 
  | IDENT _ -> 17 

// This function maps integer indexes to symbolic token ids
let tokenTagToTokenId (tokenIdx:int) = 
  match tokenIdx with
  | 0 -> TOKEN_TOKEN 
  | 1 -> TOKEN_TYPE 
  | 2 -> TOKEN_BAR 
  | 3 -> TOKEN_PERCENT_PERCENT 
  | 4 -> TOKEN_START 
  | 5 -> TOKEN_LEFT 
  | 6 -> TOKEN_RIGHT 
  | 7 -> TOKEN_NONASSOC 
  | 8 -> TOKEN_LESS 
  | 9 -> TOKEN_GREATER 
  | 10 -> TOKEN_COLON 
  | 11 -> TOKEN_PREC 
  | 12 -> TOKEN_SEMI 
  | 13 -> TOKEN_EOF 
  | 14 -> TOKEN_ERROR 
  | 15 -> TOKEN_HEADER 
  | 16 -> TOKEN_CODE 
  | 17 -> TOKEN_IDENT 
  | 20 -> TOKEN_end_of_input
  | 18 -> TOKEN_error
  | _ -> failwith "tokenTagToTokenId: bad token"

/// This function maps production indexes returned in syntax errors to strings representing the non terminal that would be produced by that production
let prodIdxToNonTerminal (prodIdx:int) = 
  match prodIdx with
    | 0 -> NONTERM__startspec 
    | 1 -> NONTERM_spec 
    | 2 -> NONTERM_headeropt 
    | 3 -> NONTERM_headeropt 
    | 4 -> NONTERM_decls 
    | 5 -> NONTERM_decls 
    | 6 -> NONTERM_decl 
    | 7 -> NONTERM_decl 
    | 8 -> NONTERM_decl 
    | 9 -> NONTERM_decl 
    | 10 -> NONTERM_decl 
    | 11 -> NONTERM_decl 
    | 12 -> NONTERM_idents 
    | 13 -> NONTERM_idents 
    | 14 -> NONTERM_rules 
    | 15 -> NONTERM_rules 
    | 16 -> NONTERM_rule 
    | 17 -> NONTERM_optbar 
    | 18 -> NONTERM_optbar 
    | 19 -> NONTERM_optsemi 
    | 20 -> NONTERM_optsemi 
    | 21 -> NONTERM_clauses 
    | 22 -> NONTERM_clauses 
    | 23 -> NONTERM_clause 
    | 24 -> NONTERM_syms 
    | 25 -> NONTERM_syms 
    | 26 -> NONTERM_syms 
    | 27 -> NONTERM_optprec 
    | 28 -> NONTERM_optprec 
    | _ -> failwith "prodIdxToNonTerminal: bad production index"

let _fsyacc_endOfInputTag = 20 
let _fsyacc_tagOfErrorTerminal = 18

// This function gets the name of a token as a string
let token_to_string (t:token) = 
  match t with 
  | TOKEN _ -> "TOKEN" 
  | TYPE _ -> "TYPE" 
  | BAR  -> "BAR" 
  | PERCENT_PERCENT  -> "PERCENT_PERCENT" 
  | START  -> "START" 
  | LEFT  -> "LEFT" 
  | RIGHT  -> "RIGHT" 
  | NONASSOC  -> "NONASSOC" 
  | LESS  -> "LESS" 
  | GREATER  -> "GREATER" 
  | COLON  -> "COLON" 
  | PREC  -> "PREC" 
  | SEMI  -> "SEMI" 
  | EOF  -> "EOF" 
  | ERROR  -> "ERROR" 
  | HEADER _ -> "HEADER" 
  | CODE _ -> "CODE" 
  | IDENT _ -> "IDENT" 

// This function gets the data carried by a token as an object
let _fsyacc_dataOfToken (t:token) = 
  match t with 
  | TOKEN _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x 
  | TYPE _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x 
  | BAR  -> (null : System.Object) 
  | PERCENT_PERCENT  -> (null : System.Object) 
  | START  -> (null : System.Object) 
  | LEFT  -> (null : System.Object) 
  | RIGHT  -> (null : System.Object) 
  | NONASSOC  -> (null : System.Object) 
  | LESS  -> (null : System.Object) 
  | GREATER  -> (null : System.Object) 
  | COLON  -> (null : System.Object) 
  | PREC  -> (null : System.Object) 
  | SEMI  -> (null : System.Object) 
  | EOF  -> (null : System.Object) 
  | ERROR  -> (null : System.Object) 
  | HEADER _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x 
  | CODE _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x 
  | IDENT _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x 
let _fsyacc_gotos = [| 0us; 65535us; 1us; 65535us; 0us; 1us; 1us; 65535us; 0us; 2us; 2us; 65535us; 2us; 3us; 7us; 8us; 2us; 65535us; 2us; 7us; 7us; 7us; 7us; 65535us; 9us; 10us; 11us; 12us; 13us; 14us; 15us; 16us; 17us; 18us; 19us; 20us; 21us; 22us; 2us; 65535us; 4us; 5us; 23us; 24us; 2us; 65535us; 4us; 23us; 23us; 23us; 1us; 65535us; 26us; 27us; 1us; 65535us; 28us; 29us; 2us; 65535us; 27us; 28us; 33us; 34us; 2us; 65535us; 27us; 32us; 33us; 32us; 4us; 65535us; 27us; 35us; 33us; 35us; 38us; 39us; 40us; 41us; 1us; 65535us; 35us; 36us; |]
let _fsyacc_sparseGotoTableRowOffsets = [|0us; 1us; 3us; 5us; 8us; 11us; 19us; 22us; 25us; 27us; 29us; 32us; 35us; 40us; |]
let _fsyacc_stateToProdIdxsTableElements = [| 1us; 0us; 1us; 0us; 1us; 1us; 1us; 1us; 1us; 1us; 1us; 1us; 1us; 2us; 1us; 5us; 1us; 5us; 1us; 6us; 1us; 6us; 1us; 7us; 1us; 7us; 1us; 8us; 1us; 8us; 1us; 9us; 1us; 9us; 1us; 10us; 1us; 10us; 1us; 11us; 1us; 11us; 1us; 12us; 1us; 12us; 2us; 14us; 15us; 1us; 14us; 1us; 16us; 1us; 16us; 1us; 16us; 1us; 16us; 1us; 16us; 1us; 18us; 1us; 20us; 2us; 21us; 22us; 1us; 21us; 1us; 21us; 1us; 23us; 1us; 23us; 1us; 23us; 1us; 24us; 1us; 24us; 1us; 25us; 1us; 25us; 1us; 28us; 1us; 28us; |]
let _fsyacc_stateToProdIdxsTableRowOffsets = [|0us; 2us; 4us; 6us; 8us; 10us; 12us; 14us; 16us; 18us; 20us; 22us; 24us; 26us; 28us; 30us; 32us; 34us; 36us; 38us; 40us; 42us; 44us; 46us; 49us; 51us; 53us; 55us; 57us; 59us; 61us; 63us; 65us; 68us; 70us; 72us; 74us; 76us; 78us; 80us; 82us; 84us; 86us; 88us; |]
let _fsyacc_action_rows = 44
let _fsyacc_actionTableElements = [|1us; 16387us; 15us; 6us; 0us; 49152us; 6us; 16388us; 0us; 9us; 1us; 11us; 4us; 13us; 5us; 15us; 6us; 17us; 7us; 19us; 1us; 32768us; 3us; 4us; 1us; 32768us; 17us; 25us; 0us; 16385us; 0us; 16386us; 6us; 16388us; 0us; 9us; 1us; 11us; 4us; 13us; 5us; 15us; 6us; 17us; 7us; 19us; 0us; 16389us; 1us; 16397us; 17us; 21us; 0us; 16390us; 1us; 16397us; 17us; 21us; 0us; 16391us; 1us; 16397us; 17us; 21us; 0us; 16392us; 1us; 16397us; 17us; 21us; 0us; 16393us; 1us; 16397us; 17us; 21us; 0us; 16394us; 1us; 16397us; 17us; 21us; 0us; 16395us; 1us; 16397us; 17us; 21us; 0us; 16396us; 1us; 16399us; 17us; 25us; 0us; 16398us; 1us; 32768us; 10us; 26us; 1us; 16401us; 2us; 30us; 2us; 16410us; 14us; 40us; 17us; 38us; 1us; 16403us; 12us; 31us; 0us; 16400us; 0us; 16402us; 0us; 16404us; 1us; 16406us; 2us; 33us; 2us; 16410us; 14us; 40us; 17us; 38us; 0us; 16405us; 1us; 16411us; 11us; 42us; 1us; 32768us; 16us; 37us; 0us; 16407us; 2us; 16410us; 14us; 40us; 17us; 38us; 0us; 16408us; 2us; 16410us; 14us; 40us; 17us; 38us; 0us; 16409us; 1us; 32768us; 17us; 43us; 0us; 16412us; |]
let _fsyacc_actionTableRowOffsets = [|0us; 2us; 3us; 10us; 12us; 14us; 15us; 16us; 23us; 24us; 26us; 27us; 29us; 30us; 32us; 33us; 35us; 36us; 38us; 39us; 41us; 42us; 44us; 45us; 47us; 48us; 50us; 52us; 55us; 57us; 58us; 59us; 60us; 62us; 65us; 66us; 68us; 70us; 71us; 74us; 75us; 78us; 79us; 81us; |]
let _fsyacc_reductionSymbolCounts = [|1us; 4us; 1us; 0us; 0us; 2us; 2us; 2us; 2us; 2us; 2us; 2us; 2us; 0us; 2us; 1us; 5us; 0us; 1us; 0us; 1us; 3us; 1us; 3us; 2us; 2us; 0us; 0us; 2us; |]
let _fsyacc_productionToNonTerminalTable = [|0us; 1us; 2us; 2us; 3us; 3us; 4us; 4us; 4us; 4us; 4us; 4us; 5us; 5us; 6us; 6us; 7us; 8us; 8us; 9us; 9us; 10us; 10us; 11us; 12us; 12us; 12us; 13us; 13us; |]
let _fsyacc_immediateActions = [|65535us; 49152us; 65535us; 65535us; 65535us; 16385us; 16386us; 65535us; 16389us; 65535us; 16390us; 65535us; 16391us; 65535us; 16392us; 65535us; 16393us; 65535us; 16394us; 65535us; 16395us; 65535us; 16396us; 65535us; 16398us; 65535us; 65535us; 65535us; 65535us; 16400us; 16402us; 16404us; 65535us; 65535us; 16405us; 65535us; 65535us; 16407us; 65535us; 16408us; 65535us; 16409us; 65535us; 16412us; |]
let _fsyacc_reductions ()  =    [| 
# 216 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : AST.ParserSpec)) in
            Microsoft.FSharp.Core.Operators.box
                (
                   (
                      raise (Internal.Utilities.Text.Parsing.Accept(Microsoft.FSharp.Core.Operators.box _1))
                   )
                 : '_startspec));
# 225 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'headeropt)) in
            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : 'decls)) in
            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data : 'rules)) in
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 25 "fsyaccpars.fsy"
                           List.foldBack (fun f x -> f x) _2 { Header=_1;Tokens=[];Types=[];Associativities=[];StartSymbols=[];Rules=_4 } 
                   )
# 25 "fsyaccpars.fsy"
                 : AST.ParserSpec));
# 238 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : AST.Code)) in
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 29 "fsyaccpars.fsy"
                              _1 
                   )
# 29 "fsyaccpars.fsy"
                 : 'headeropt));
# 249 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 31 "fsyaccpars.fsy"
                             "", (parseState.ResultRange |> fst)
                   )
# 31 "fsyaccpars.fsy"
                 : 'headeropt));
# 259 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 34 "fsyaccpars.fsy"
                           [] 
                   )
# 34 "fsyaccpars.fsy"
                 : 'decls));
# 269 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'decl)) in
            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : 'decls)) in
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 35 "fsyaccpars.fsy"
                                      _1 :: _2 
                   )
# 35 "fsyaccpars.fsy"
                 : 'decls));
# 281 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : string option)) in
            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : 'idents)) in
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 38 "fsyaccpars.fsy"
                                        (fun x -> {x with Tokens = x.Tokens @ (List.map (fun x -> (x,_1)) _2)}) 
                   )
# 38 "fsyaccpars.fsy"
                 : 'decl));
# 293 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : 'idents)) in
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 39 "fsyaccpars.fsy"
                                         (fun x -> {x with Types = x.Types @ (List.map (fun x -> (x,_1)) _2)} ) 
                   )
# 39 "fsyaccpars.fsy"
                 : 'decl));
# 305 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : 'idents)) in
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 40 "fsyaccpars.fsy"
                                          (fun x -> {x with StartSymbols = x.StartSymbols @ _2} ) 
                   )
# 40 "fsyaccpars.fsy"
                 : 'decl));
# 316 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : 'idents)) in
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 41 "fsyaccpars.fsy"
                                         (fun x -> {x with Associativities = x.Associativities @ [(List.map (fun x -> (x,LeftAssoc)) _2)]} ) 
                   )
# 41 "fsyaccpars.fsy"
                 : 'decl));
# 327 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : 'idents)) in
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 42 "fsyaccpars.fsy"
                                          (fun x -> {x with Associativities = x.Associativities @ [(List.map (fun x -> (x,RightAssoc)) _2)]} ) 
                   )
# 42 "fsyaccpars.fsy"
                 : 'decl));
# 338 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : 'idents)) in
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 43 "fsyaccpars.fsy"
                                             (fun x -> {x with Associativities = x.Associativities @ [(List.map (fun x -> (x,NonAssoc)) _2)]} ) 
                   )
# 43 "fsyaccpars.fsy"
                 : 'decl));
# 349 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : 'idents)) in
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 45 "fsyaccpars.fsy"
                                            _1 :: _2 
                   )
# 45 "fsyaccpars.fsy"
                 : 'idents));
# 361 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 45 "fsyaccpars.fsy"
                                                           [] 
                   )
# 45 "fsyaccpars.fsy"
                 : 'idents));
# 371 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'rule)) in
            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : 'rules)) in
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 46 "fsyaccpars.fsy"
                                         _1 :: _2 
                   )
# 46 "fsyaccpars.fsy"
                 : 'rules));
# 383 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'rule)) in
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 46 "fsyaccpars.fsy"
                                                             [_1] 
                   )
# 46 "fsyaccpars.fsy"
                 : 'rules));
# 394 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data : 'optbar)) in
            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data : 'clauses)) in
            let _5 = (let data = parseState.GetInput(5) in (Microsoft.FSharp.Core.Operators.unbox data : 'optsemi)) in
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 47 "fsyaccpars.fsy"
                                                                (_1,_4) 
                   )
# 47 "fsyaccpars.fsy"
                 : 'rule));
# 408 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 48 "fsyaccpars.fsy"
                               
                   )
# 48 "fsyaccpars.fsy"
                 : 'optbar));
# 418 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 48 "fsyaccpars.fsy"
                                         
                   )
# 48 "fsyaccpars.fsy"
                 : 'optbar));
# 428 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 49 "fsyaccpars.fsy"
                                
                   )
# 49 "fsyaccpars.fsy"
                 : 'optsemi));
# 438 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 49 "fsyaccpars.fsy"
                                           
                   )
# 49 "fsyaccpars.fsy"
                 : 'optsemi));
# 448 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'clause)) in
            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data : 'clauses)) in
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 50 "fsyaccpars.fsy"
                                                  _1 :: _3 
                   )
# 50 "fsyaccpars.fsy"
                 : 'clauses));
# 460 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'clause)) in
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 50 "fsyaccpars.fsy"
                                                                        [_1] 
                   )
# 50 "fsyaccpars.fsy"
                 : 'clauses));
# 471 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'syms)) in
            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : 'optprec)) in
            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data : AST.Code)) in
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 51 "fsyaccpars.fsy"
                                                 Rule(_1,_2,Some _3) 
                   )
# 51 "fsyaccpars.fsy"
                 : 'clause));
# 484 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : 'syms)) in
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 52 "fsyaccpars.fsy"
                                        _1 :: _2 
                   )
# 52 "fsyaccpars.fsy"
                 : 'syms));
# 496 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : 'syms)) in
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 52 "fsyaccpars.fsy"
                                                                  "error" :: _2 
                   )
# 52 "fsyaccpars.fsy"
                 : 'syms));
# 507 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 52 "fsyaccpars.fsy"
                                                                                      [] 
                   )
# 52 "fsyaccpars.fsy"
                 : 'syms));
# 517 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 53 "fsyaccpars.fsy"
                                None 
                   )
# 53 "fsyaccpars.fsy"
                 : 'optprec));
# 527 "fsyaccpars.fs"
        (fun (parseState : Internal.Utilities.Text.Parsing.IParseState) ->
            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
            Microsoft.FSharp.Core.Operators.box
                (
                   (
# 53 "fsyaccpars.fsy"
                                                      Some _2 
                   )
# 53 "fsyaccpars.fsy"
                 : 'optprec));
|]
# 539 "fsyaccpars.fs"
let tables () : Internal.Utilities.Text.Parsing.Tables<_> = 
  { reductions= _fsyacc_reductions ();
    endOfInputTag = _fsyacc_endOfInputTag;
    tagOfToken = tagOfToken;
    dataOfToken = _fsyacc_dataOfToken; 
    actionTableElements = _fsyacc_actionTableElements;
    actionTableRowOffsets = _fsyacc_actionTableRowOffsets;
    stateToProdIdxsTableElements = _fsyacc_stateToProdIdxsTableElements;
    stateToProdIdxsTableRowOffsets = _fsyacc_stateToProdIdxsTableRowOffsets;
    reductionSymbolCounts = _fsyacc_reductionSymbolCounts;
    immediateActions = _fsyacc_immediateActions;
    gotos = _fsyacc_gotos;
    sparseGotoTableRowOffsets = _fsyacc_sparseGotoTableRowOffsets;
    tagOfErrorTerminal = _fsyacc_tagOfErrorTerminal;
    parseError = (fun (ctxt:Internal.Utilities.Text.Parsing.ParseErrorContext<_>) -> 
                              match parse_error_rich with 
                              | Some f -> f ctxt
                              | None -> parse_error ctxt.Message);
    numTerminals = 21;
    productionToNonTerminalTable = _fsyacc_productionToNonTerminalTable  }
let engine lexer lexbuf startState = (tables ()).Interpret(lexer, lexbuf, startState)
let spec lexer lexbuf : AST.ParserSpec =
    Microsoft.FSharp.Core.Operators.unbox ((tables ()).Interpret(lexer, lexbuf, 0))
