8 people like it.

Small Basic Parser

Small Basic abstract syntax tree, parser and interpreter. Supports Small Basic's keywords and arithmetic, logical and comparison operators.

Abstract Syntax Tree

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
28: 
29: 
30: 
31: 
32: 
33: 
34: 
35: 
36: 
37: 
38: 
39: 
40: 
41: 
42: 
43: 
44: 
45: 
46: 
47: 
48: 
49: 
50: 
51: 
52: 
53: 
54: 
// Type abbreviations
type label = string
type identifier = string
type index = int
type Hashtable<'k,'v> = System.Collections.Generic.Dictionary<'k,'v>
/// Small Basic arithmetic operation
type arithmetic = Add | Subtract | Multiply | Divide
/// Small Basic comparison operaton
type comparison = Eq | Ne | Lt | Gt | Le | Ge
/// Small Basic logical operation
type logical = And | Or
/// Small Basic value
type value =
    | Bool of bool
    | Int of int
    | Double of double
    | String of string
    | Array of Hashtable<value,value>
/// Small Basic expression
type expr =
    | Literal of value
    | Var of identifier
    | GetAt of location
    | Func of invoke
    | Neg of expr
    | Arithmetic of expr * arithmetic * expr
    | Comparison of expr * comparison * expr
    | Logical of expr * logical * expr
and location =
    | Location of identifier * expr list
and invoke =
    | Method of string * string * expr[]
    | PropertyGet of string * string
type assign =
    | Set of identifier * expr
/// Small Basic instruction
type instruction =
    | Assign of assign
    | SetAt of location * expr
    | PropertySet of string * string * expr
    | Action of invoke
    | For of assign * expr * expr
    | EndFor
    | If of expr
    | ElseIf of expr
    | Else
    | EndIf
    | While of expr
    | EndWhile
    | Sub of identifier
    | EndSub
    | GoSub of identifier
    | Label of label
    | Goto of label

Parser

  1: 
  2: 
  3: 
  4: 
  5: 
  6: 
  7: 
  8: 
  9: 
 10: 
 11: 
 12: 
 13: 
 14: 
 15: 
 16: 
 17: 
 18: 
 19: 
 20: 
 21: 
 22: 
 23: 
 24: 
 25: 
 26: 
 27: 
 28: 
 29: 
 30: 
 31: 
 32: 
 33: 
 34: 
 35: 
 36: 
 37: 
 38: 
 39: 
 40: 
 41: 
 42: 
 43: 
 44: 
 45: 
 46: 
 47: 
 48: 
 49: 
 50: 
 51: 
 52: 
 53: 
 54: 
 55: 
 56: 
 57: 
 58: 
 59: 
 60: 
 61: 
 62: 
 63: 
 64: 
 65: 
 66: 
 67: 
 68: 
 69: 
 70: 
 71: 
 72: 
 73: 
 74: 
 75: 
 76: 
 77: 
 78: 
 79: 
 80: 
 81: 
 82: 
 83: 
 84: 
 85: 
 86: 
 87: 
 88: 
 89: 
 90: 
 91: 
 92: 
 93: 
 94: 
 95: 
 96: 
 97: 
 98: 
 99: 
100: 
101: 
102: 
103: 
104: 
105: 
106: 
107: 
108: 
109: 
110: 
111: 
112: 
113: 
114: 
115: 
116: 
117: 
118: 
119: 
120: 
121: 
122: 
123: 
124: 
125: 
126: 
127: 
128: 
129: 
130: 
131: 
132: 
133: 
134: 
135: 
open FParsec

let pnumliteral: Parser<expr, unit> =
    let numberFormat = NumberLiteralOptions.AllowFraction
    numberLiteral numberFormat "number"
    |>> fun nl ->
            if nl.IsInteger then Literal(Int (int nl.String))
            else Literal(Double (float nl.String))

let ws = skipManySatisfy (fun c -> c = ' ' || c = '\t' || c='\r') // spaces
let str_ws s = pstring s .>> ws
let str_ws1 s = pstring s .>> spaces1

let pstringliteral = 
    between (pstring "\"") (pstring "\"") (manySatisfy (fun x -> x <> '"')) 
    |>> (fun s -> Literal(String(s)))

let pidentifier =
    let isIdentifierFirstChar c = isLetter c || c = '_'
    let isIdentifierChar c = isLetter c || isDigit c || c = '_'
    many1Satisfy2L isIdentifierFirstChar isIdentifierChar "identifier"
let pidentifier_ws = pidentifier .>> ws
let pvar = pidentifier |>> (fun x -> Var(x))

let pinvoke, pinvokeimpl = createParserForwardedToRef ()
let pfunc = pinvoke |>> (fun x -> Func(x))

let plocation, plocationimpl = createParserForwardedToRef ()
let pgetat = plocation |>> (fun loc -> GetAt(loc))

let pvalue = 
    choice [
        pnumliteral; pstringliteral
        attempt pgetat <|> attempt pfunc <|> attempt pvar
    ]

type Assoc = Associativity

let oppa = new OperatorPrecedenceParser<expr,unit,unit>()
let parithmetic = oppa.ExpressionParser
let terma = (pvalue .>> ws) <|> between (str_ws "(") (str_ws ")") parithmetic
oppa.TermParser <- terma
oppa.AddOperator(InfixOperator("+", ws, 1, Assoc.Left, fun x y -> Arithmetic(x, Add, y)))
oppa.AddOperator(InfixOperator("-", ws, 1, Assoc.Left, fun x y -> Arithmetic(x, Subtract, y)))
oppa.AddOperator(InfixOperator("*", ws, 2, Assoc.Left, fun x y -> Arithmetic(x, Multiply, y)))
oppa.AddOperator(InfixOperator("/", ws, 2, Assoc.Left, fun x y -> Arithmetic(x, Divide, y)))
oppa.AddOperator(PrefixOperator("-", ws, 2, true, fun x -> Neg(x)))

let oppc = new OperatorPrecedenceParser<expr,unit,unit>()
let pcomparison = oppc.ExpressionParser
let termc = (parithmetic .>> ws) <|> between (str_ws "(") (str_ws ")") pcomparison
oppc.TermParser <- termc
oppc.AddOperator(InfixOperator("=", ws, 1, Assoc.Left, fun x y -> Comparison(x, Eq, y)))
oppc.AddOperator(InfixOperator("<>", ws, 1, Assoc.Left, fun x y -> Comparison(x, Ne, y)))
oppc.AddOperator(InfixOperator("<=", ws, 2, Assoc.Left, fun x y -> Comparison(x, Le, y)))
oppc.AddOperator(InfixOperator(">=", ws, 2, Assoc.Left, fun x y -> Comparison(x, Ge, y)))
oppc.AddOperator(InfixOperator("<", ws, 2, Assoc.Left, fun x y -> Comparison(x, Lt, y)))
oppc.AddOperator(InfixOperator(">", ws, 2, Assoc.Left, fun x y -> Comparison(x, Gt, y)))

let oppl = new OperatorPrecedenceParser<expr,unit,unit>()
let plogical = oppl.ExpressionParser
let terml = (pcomparison .>> ws) <|> between (str_ws "(") (str_ws ")") plogical
oppl.TermParser <- terml
oppl.AddOperator(InfixOperator("And", ws, 1, Assoc.Left, fun x y -> Logical(x,And,y)))
oppl.AddOperator(InfixOperator("Or", ws, 1, Assoc.Left, fun x y -> Logical(x,Or,y)))

let pmember = pipe3 (pidentifier_ws) (pchar '.') (pidentifier_ws) (fun tn _ mn -> tn,mn) 
let ptuple = between (str_ws "(") (str_ws ")") (sepBy parithmetic (str_ws ","))
pinvokeimpl := 
    pipe2 pmember (opt ptuple)
        (fun (tn,mn) args -> 
        match args with
        | Some args -> Method(tn, mn, args |> List.toArray)
        | None -> PropertyGet(tn,mn)
        )

let paction = pinvoke |>> (fun x -> Action(x))
let pset = pipe3 pidentifier_ws (str_ws "=") parithmetic (fun id _ e -> Set(id, e))
let passign = pipe3 pidentifier_ws (str_ws "=") parithmetic (fun id _ e -> Assign(Set(id, e)))
let ppropertyset = pipe3 pmember (str_ws "=") parithmetic (fun (tn,pn) _ e -> PropertySet(tn,pn,e))

let pindex = str_ws "[" >>. parithmetic .>> str_ws "]"
let pindices = many1 pindex
plocationimpl := pipe2 pidentifier_ws pindices (fun id xs -> Location(id,xs))
let psetat = pipe3 plocation (str_ws "=") parithmetic (fun loc _ e -> SetAt(loc, e))

let pfor =
    let pfrom = str_ws1 "For" >>. pset
    let pto = str_ws1 "To" >>. parithmetic
    let pstep = str_ws1 "Step" >>. parithmetic
    let toStep = function None -> Literal(Int(1)) | Some s -> s
    pipe3 pfrom pto (opt pstep) (fun f t s -> For(f, t, toStep s))
let pendfor = str_ws "EndFor" |>> (fun _ -> EndFor)

let pwhile = str_ws1 "While" >>. plogical |>> (fun e -> While(e))
let pendwhile = str_ws "EndWhile" |>> (fun _ -> EndWhile)

let pif = str_ws1 "If" >>. plogical .>> str_ws "Then" |>> (fun e -> If(e))
let pelseif = str_ws1 "ElseIf" >>. pcomparison .>> str_ws "Then" |>> (fun e -> ElseIf(e))
let pelse = str_ws "Else" |>> (fun _ -> Else)
let pendif = str_ws "EndIf" |>> (fun _ -> EndIf)

let psub = str_ws1 "Sub" >>. pidentifier |>> (fun name -> Sub(name))
let pendsub = str_ws "EndSub" |>> (fun _ -> EndSub)
let pgosub = pidentifier_ws .>> str_ws "()" |>> (fun routine -> GoSub(routine))

let plabel = pidentifier_ws .>> str_ws ":" |>> (fun label -> Label(label))
let pgoto = str_ws1 "Goto" >>. pidentifier |>> (fun label -> Goto(label))

let pinstruct = 
    [
        pfor;pendfor
        pwhile;pendwhile
        pif; pelseif; pelse; pendif
        psub; pendsub; pgosub                 
        ppropertyset; passign; psetat
        paction
        plabel; pgoto
    ]
    |> List.map attempt
    |> choice

type Line = Blank | Instruction of instruction
let pcomment = pchar '\'' >>. skipManySatisfy (fun c -> c <> '\n') >>. pchar '\n'
let peol = pcomment <|> (pchar '\n')
let pinstruction = ws >>. pinstruct .>> peol |>> (fun i -> Instruction i)
let pblank = ws >>. peol |>> (fun _ -> Blank)
let plines = many (pinstruction <|> pblank) .>> eof
let parse (program:string) =    
    match run plines program with
    | Success(result, _, _)   -> 
        result 
        |> List.choose (function Instruction i -> Some i | Blank -> None) 
        |> List.toArray
    | Failure(errorMsg, e, s) -> failwith errorMsg

Library

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
type TextWindow private () =
    static member WriteLine (o:obj) = System.Console.WriteLine(o)
    static member ForegroundColor
        with get () = System.Console.ForegroundColor.ToString()
        and set color =   
            let color = Color.Parse(typeof<Color>, color, true)
            System.Console.ForegroundColor <- color :?> Color
type Clock private () =
    static let now() = System.DateTime.Now
    static member Year = now().Year
    static member Month = now().Month
    static member Day = now().Day

type IMarker = interface end
let getLibraryType name = typeof<IMarker>.DeclaringType.GetNestedType(name) 

Interpreter

  1: 
  2: 
  3: 
  4: 
  5: 
  6: 
  7: 
  8: 
  9: 
 10: 
 11: 
 12: 
 13: 
 14: 
 15: 
 16: 
 17: 
 18: 
 19: 
 20: 
 21: 
 22: 
 23: 
 24: 
 25: 
 26: 
 27: 
 28: 
 29: 
 30: 
 31: 
 32: 
 33: 
 34: 
 35: 
 36: 
 37: 
 38: 
 39: 
 40: 
 41: 
 42: 
 43: 
 44: 
 45: 
 46: 
 47: 
 48: 
 49: 
 50: 
 51: 
 52: 
 53: 
 54: 
 55: 
 56: 
 57: 
 58: 
 59: 
 60: 
 61: 
 62: 
 63: 
 64: 
 65: 
 66: 
 67: 
 68: 
 69: 
 70: 
 71: 
 72: 
 73: 
 74: 
 75: 
 76: 
 77: 
 78: 
 79: 
 80: 
 81: 
 82: 
 83: 
 84: 
 85: 
 86: 
 87: 
 88: 
 89: 
 90: 
 91: 
 92: 
 93: 
 94: 
 95: 
 96: 
 97: 
 98: 
 99: 
100: 
101: 
102: 
103: 
104: 
105: 
106: 
107: 
108: 
109: 
110: 
111: 
112: 
113: 
114: 
115: 
116: 
117: 
118: 
119: 
120: 
121: 
122: 
123: 
124: 
125: 
126: 
127: 
128: 
129: 
130: 
131: 
132: 
133: 
134: 
135: 
136: 
137: 
138: 
139: 
140: 
141: 
142: 
143: 
144: 
145: 
146: 
147: 
148: 
149: 
150: 
151: 
152: 
153: 
154: 
155: 
156: 
157: 
158: 
159: 
160: 
161: 
162: 
163: 
164: 
165: 
166: 
167: 
168: 
169: 
170: 
171: 
172: 
173: 
174: 
175: 
176: 
177: 
178: 
179: 
180: 
181: 
182: 
183: 
184: 
185: 
186: 
187: 
188: 
189: 
190: 
191: 
192: 
193: 
194: 
195: 
196: 
197: 
198: 
199: 
200: 
201: 
202: 
203: 
204: 
205: 
206: 
/// Converts value to obj
let fromObj (x:obj) =
    match x with
    | :? bool as x -> Bool x
    | :? int as x -> Int x
    | :? double as x -> Double x
    | :? string as x -> String x
    | null -> Int 0
    | x -> raise (new System.NotSupportedException(x.ToString()))
/// Converts value to obj
let toObj = function
    | Bool x -> box x
    | Int x -> box x
    | Double x -> box x
    | String x -> box x
    | Array x -> raise (new System.NotSupportedException(x.ToString()))
/// Converts value to int
let toInt = function
    | Bool x -> raise (new System.NotSupportedException())
    | Int x -> x
    | Double x -> int x
    | String x -> int x
    | Array x -> raise (new System.NotSupportedException(x.ToString()))
/// Converts value to bool
let toBool = function
    | Bool x -> x
    | _ -> raise (new System.NotSupportedException())
/// Converts value to array
let toArray = function
    | Array x -> x
    | _ -> raise (new System.NotSupportedException())
/// Coerces a tuple of numeric values to double
let (|AsDoubles|_|) = function
    | Double l, Double r -> Some(l,r)
    | Int l, Double r -> Some(double l,r)
    | Double l, Int r -> Some(l,double r)
    | _, _ -> None
/// Compares values
let compare lhs rhs =
    match lhs, rhs with
    | Bool l, Bool r -> l.CompareTo(r)
    | Int l, Int r -> l.CompareTo(r)
    | AsDoubles (l,r) -> l.CompareTo(r)
    | String l, String r -> l.CompareTo(r)
    | _ -> raise (new System.NotSupportedException(sprintf "%A %A" lhs rhs))

open System.Collections.Generic

type VarLookup = Dictionary<identifier,value>

/// Evaluates expressions
let rec eval state (expr:expr) =
    let (vars:VarLookup) = state
    match expr with
    | Literal x -> x
    | Var identifier -> vars.[identifier]
    | GetAt(Location(identifier,[index])) -> 
        let array = vars.[identifier] |> toArray
        array.[eval state index]
    | GetAt(Location(identifier,xs)) -> raise (System.NotSupportedException())
    | Func(call) -> invoke state call
    | Neg x -> arithmetic (eval state x) Multiply (Int(-1))
    | Arithmetic(l,op,r) -> arithmetic (eval state l) op (eval state r)
    | Comparison(l,op,r) -> comparison (eval state l) op (eval state r)
    | Logical(l,op,r) -> logical (eval state l) op (eval state r)
and comparison lhs op rhs =
    let x = compare lhs rhs
    match op with
    | Eq -> x = 0   | Ne -> x <> 0
    | Lt -> x < 0   | Gt -> x > 0
    | Le -> x <= 0  | Ge -> x >= 0
    |> fromObj
and arithmetic lhs op rhs =
    match op, (lhs, rhs) with
    | Add, (Int l,Int r) -> Int(l + r)
    | Add, AsDoubles (l,r) -> Double(l + r)
    | Add, (String l, String r) -> String(l + r)
    | Subtract, (Int l,Int r) -> Int(l - r)
    | Subtract, AsDoubles (l,r) -> Double(l - r)
    | Multiply, (Int l,Int r) -> Int(l * r)
    | Multiply, AsDoubles (l,r) -> Double(l * r)
    | Divide, (Int l,Int r) -> Int(l - r)
    | Divide, AsDoubles (l,r) -> Double(l - r)
    | _ -> raise (System.NotImplementedException())
and logical lhs op rhs =
    match op, lhs, rhs with
    | And, Bool l, Bool r -> Bool(l && r)
    | Or, Bool l, Bool r -> Bool(l || r)
    | _, _, _ -> raise (System.NotSupportedException())
and invoke state invoke =
    match invoke with
    | Method(tn, name, args) ->
        let t = getLibraryType tn
        let mi = t.GetMethod(name)
        let args = args |> Array.map (eval state >> toObj)
        mi.Invoke(null, args) |> fromObj
    | PropertyGet(tn, name) ->
        let t = getLibraryType tn
        let pi = t.GetProperty(name)
        pi.GetValue(null) |> fromObj

/// Runs program
let run (program:instruction[]) =
    /// Program index
    let pi = ref 0
    /// Variable lookup   
    let variables = VarLookup()   
    /// For from EndFor lookup
    let forLoops = Dictionary<index, index * identifier * expr * expr>()
    /// While from EndWhile lookup
    let whileLoops = Dictionary<index, index>()
    /// Call stack for Gosubs
    let callStack = Stack<index>()
    /// Evaluates expression with variables
    let eval = eval variables
    /// Assigns variable with result of expression
    let assign (Set(identifier,expr)) = variables.[identifier] <- eval expr    
    /// Sets property with result of expression
    let propertySet(tn,pn,expr) =
        let t = getLibraryType tn
        let pi = t.GetProperty(pn)
        pi.SetValue(null, eval expr |> toObj)
    /// Obtains an array for the specified identifier
    let obtainArray identifier =
        match variables.TryGetValue(identifier) with
        | true, Array(array) -> array
        | true, _ -> raise (System.NotSupportedException())
        | false, _ -> 
            let array = Hashtable<value,value>()
            variables.Add(identifier,Array(array))
            array
    /// Sets array value at index with result of expression
    let setAt(identifier,index,expr) =        
        let array = obtainArray identifier
        array.[eval index] <- eval expr
    /// Finds first index of instructions
    let findFirstIndex start (inc,dec) isMatch =
        let mutable i = start
        let mutable nest = 0
        while nest > 0 || isMatch program.[i] |> not do 
            if inc program.[i] then nest <- nest + 1
            if nest > 0 && dec program.[i] then nest <- nest - 1
            i <- i + 1
        i
    /// Finds index of instruction
    let findIndex start (inc,dec) instruction =
        findFirstIndex start (inc,dec) ((=) instruction)
    let isIf = function If(_) -> true | _ -> false
    let isElseIf = function ElseIf(_) -> true | _ -> false
    let isElse = (=) Else
    let isEndIf = (=) EndIf
    let isFor = function For(_,_,_) -> true | _ -> false
    let isEndFor = (=) EndFor    
    let isWhile = function While(_) -> true | _ -> false
    let isEndWhile = (=) EndWhile
    let isFalse _ = false
    /// Instruction step
    let step () =
        let instruction = program.[!pi]
        match instruction with
        | Assign(set) -> assign set
        | PropertySet(tn,pn,expr) -> propertySet(tn,pn,expr)           
        | SetAt(Location(identifier,[index]),expr) -> setAt(identifier,index,expr)
        | SetAt(_) -> raise (System.NotImplementedException())
        | Action(call) -> invoke variables call |> ignore
        | If(condition) | ElseIf(condition) ->           
            if eval condition |> toBool |> not then
                let isMatch x = isElseIf x || isElse x || isEndIf x
                let index = findFirstIndex (!pi+1) (isIf, isEndIf) isMatch
                pi := 
                    if program.[index] |> isElseIf 
                    then index - 1
                    else index         
        | Else ->
            let index = findIndex !pi (isIf,isEndIf) EndIf
            pi := index
        | EndIf -> ()
        | For((Set(identifier,expr) as from), target, step) ->
            assign from
            let index = findIndex (!pi+1) (isFor,isEndFor) EndFor
            forLoops.[index] <- (!pi, identifier, target, step)
            if toInt(variables.[identifier]) > toInt(eval target) 
            then pi := index
        | EndFor ->
            let start, identifier, target, step = forLoops.[!pi]
            let x = variables.[identifier]
            variables.[identifier] <- arithmetic x Add (eval step)
            if toInt(variables.[identifier]) <= toInt(eval target) 
            then pi := start
        | While condition ->
            let index = findIndex (!pi+1) (isWhile,isEndWhile) EndWhile
            whileLoops.[index] <- !pi 
            if eval condition |> toBool |> not then pi := index
        | EndWhile ->
            pi := whileLoops.[!pi] - 1
        | Sub(identifier) ->
            pi := findIndex (!pi+1) (isFalse, isFalse) EndSub
        | GoSub(identifier) ->
            let index = findIndex 0 (isFalse, isFalse) (Sub(identifier))
            callStack.Push(!pi)
            pi := index
        | EndSub ->
            pi := callStack.Pop()
        | Label(label) -> ()
        | Goto(label) -> pi := findIndex 0 (isFalse,isFalse) (Label(label))
    while !pi < program.Length do step (); incr pi

Fizz Buzz sample

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
28: 
29: 
30: 
31: 
let source = """
' Sets Result to Modulus
Sub Modulus
  Result = Dividend
  While Result >= Divisor
    Result = Result - Divisor
  EndWhile
EndSub

For A = 1 To 100 ' Print from 1 to 100
  Dividend = A
  Divisor = 3
  Modulus()
  Mod3 = Result ' A % 3
  Divisor = 5
  Modulus()
  Mod5 = Result ' A % 5
  If Mod3 = 0 And Mod5 = 0 Then
    TextWindow.WriteLine("FizzBuzz")  
  ElseIf Mod3 = 0 Then
    TextWindow.WriteLine("Fizz")
  ElseIf Mod5 = 0 Then
    TextWindow.WriteLine("Buzz")
  Else
    TextWindow.WriteLine(A)        
  EndIf
EndFor
"""

let program = parse source
run program
type label = string

Full name: Script.label
Multiple items
val string : value:'T -> string

Full name: Microsoft.FSharp.Core.Operators.string

--------------------
type string = System.String

Full name: Microsoft.FSharp.Core.string
type identifier = string

Full name: Script.identifier
type index = int

Full name: Script.index
Multiple items
val int : value:'T -> int (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.int

--------------------
type int = int32

Full name: Microsoft.FSharp.Core.int

--------------------
type int<'Measure> = int

Full name: Microsoft.FSharp.Core.int<_>
type Hashtable<'k,'v> = System.Collections.Generic.Dictionary<'k,'v>

Full name: Script.Hashtable<_,_>
namespace System
namespace System.Collections
namespace System.Collections.Generic
Multiple items
type Dictionary<'TKey,'TValue> =
  new : unit -> Dictionary<'TKey, 'TValue> + 5 overloads
  member Add : key:'TKey * value:'TValue -> unit
  member Clear : unit -> unit
  member Comparer : IEqualityComparer<'TKey>
  member ContainsKey : key:'TKey -> bool
  member ContainsValue : value:'TValue -> bool
  member Count : int
  member GetEnumerator : unit -> Enumerator<'TKey, 'TValue>
  member GetObjectData : info:SerializationInfo * context:StreamingContext -> unit
  member Item : 'TKey -> 'TValue with get, set
  ...
  nested type Enumerator
  nested type KeyCollection
  nested type ValueCollection

Full name: System.Collections.Generic.Dictionary<_,_>

--------------------
System.Collections.Generic.Dictionary() : unit
System.Collections.Generic.Dictionary(capacity: int) : unit
System.Collections.Generic.Dictionary(comparer: System.Collections.Generic.IEqualityComparer<'TKey>) : unit
System.Collections.Generic.Dictionary(dictionary: System.Collections.Generic.IDictionary<'TKey,'TValue>) : unit
System.Collections.Generic.Dictionary(capacity: int, comparer: System.Collections.Generic.IEqualityComparer<'TKey>) : unit
System.Collections.Generic.Dictionary(dictionary: System.Collections.Generic.IDictionary<'TKey,'TValue>, comparer: System.Collections.Generic.IEqualityComparer<'TKey>) : unit
type arithmetic =
  | Add
  | Subtract
  | Multiply
  | Divide

Full name: Script.arithmetic


 Small Basic arithmetic operation
union case arithmetic.Add: arithmetic
union case arithmetic.Subtract: arithmetic
union case arithmetic.Multiply: arithmetic
union case arithmetic.Divide: arithmetic
type comparison =
  | Eq
  | Ne
  | Lt
  | Gt
  | Le
  | Ge

Full name: Script.comparison


 Small Basic comparison operaton
union case comparison.Eq: comparison
union case comparison.Ne: comparison
union case comparison.Lt: comparison
union case comparison.Gt: comparison
union case comparison.Le: comparison
union case comparison.Ge: comparison
type logical =
  | And
  | Or

Full name: Script.logical


 Small Basic logical operation
union case logical.And: logical
union case logical.Or: logical
type value =
  | Bool of bool
  | Int of int
  | Double of double
  | String of string
  | Array of Hashtable<value,value>

Full name: Script.value


 Small Basic value
union case value.Bool: bool -> value
type bool = System.Boolean

Full name: Microsoft.FSharp.Core.bool
union case value.Int: int -> value
union case value.Double: double -> value
Multiple items
val double : value:'T -> double (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.double

--------------------
type double = System.Double

Full name: Microsoft.FSharp.Core.double
Multiple items
union case value.String: string -> value

--------------------
module String

from Microsoft.FSharp.Core
Multiple items
union case value.Array: Hashtable<value,value> -> value

--------------------
module Array

from Microsoft.FSharp.Collections
type expr =
  | Literal of value
  | Var of identifier
  | GetAt of location
  | Func of invoke
  | Neg of expr
  | Arithmetic of expr * arithmetic * expr
  | Comparison of expr * comparison * expr
  | Logical of expr * logical * expr

Full name: Script.expr


 Small Basic expression
Multiple items
union case expr.Literal: value -> expr

--------------------
type LiteralAttribute =
  inherit Attribute
  new : unit -> LiteralAttribute

Full name: Microsoft.FSharp.Core.LiteralAttribute

--------------------
new : unit -> LiteralAttribute
union case expr.Var: identifier -> expr
union case expr.GetAt: location -> expr
type location = | Location of identifier * expr list

Full name: Script.location
union case expr.Func: invoke -> expr
type invoke =
  | Method of string * string * expr []
  | PropertyGet of string * string

Full name: Script.invoke
union case expr.Neg: expr -> expr
union case expr.Arithmetic: expr * arithmetic * expr -> expr
union case expr.Comparison: expr * comparison * expr -> expr
union case expr.Logical: expr * logical * expr -> expr
union case location.Location: identifier * expr list -> location
type 'T list = List<'T>

Full name: Microsoft.FSharp.Collections.list<_>
union case invoke.Method: string * string * expr [] -> invoke
union case invoke.PropertyGet: string * string -> invoke
type assign = | Set of identifier * expr

Full name: Script.assign
Multiple items
union case assign.Set: identifier * expr -> assign

--------------------
module Set

from Microsoft.FSharp.Collections

--------------------
type Set<'T (requires comparison)> =
  interface IComparable
  interface IEnumerable
  interface IEnumerable<'T>
  interface ICollection<'T>
  new : elements:seq<'T> -> Set<'T>
  member Add : value:'T -> Set<'T>
  member Contains : value:'T -> bool
  override Equals : obj -> bool
  member IsProperSubsetOf : otherSet:Set<'T> -> bool
  member IsProperSupersetOf : otherSet:Set<'T> -> bool
  ...

Full name: Microsoft.FSharp.Collections.Set<_>

--------------------
new : elements:seq<'T> -> Set<'T>
type instruction =
  | Assign of assign
  | SetAt of location * expr
  | PropertySet of string * string * expr
  | Action of invoke
  | For of assign * expr * expr
  | EndFor
  | If of expr
  | ElseIf of expr
  | Else
  | EndIf
  ...

Full name: Script.instruction


 Small Basic instruction
union case instruction.Assign: assign -> instruction
union case instruction.SetAt: location * expr -> instruction
union case instruction.PropertySet: string * string * expr -> instruction
union case instruction.Action: invoke -> instruction
union case instruction.For: assign * expr * expr -> instruction
union case instruction.EndFor: instruction
union case instruction.If: expr -> instruction
union case instruction.ElseIf: expr -> instruction
union case instruction.Else: instruction
union case instruction.EndIf: instruction
union case instruction.While: expr -> instruction
union case instruction.EndWhile: instruction
union case instruction.Sub: identifier -> instruction
union case instruction.EndSub: instruction
union case instruction.GoSub: identifier -> instruction
union case instruction.Label: label -> instruction
union case instruction.Goto: label -> instruction
val pnumliteral : obj

Full name: Script.pnumliteral
type unit = Unit

Full name: Microsoft.FSharp.Core.unit
val numberFormat : obj
val nl : obj
Multiple items
val float : value:'T -> float (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.float

--------------------
type float = System.Double

Full name: Microsoft.FSharp.Core.float

--------------------
type float<'Measure> = float

Full name: Microsoft.FSharp.Core.float<_>
val ws : obj

Full name: Script.ws
val str_ws : s:'a -> obj

Full name: Script.str_ws
val s : 'a
val str_ws1 : s:'a -> '_arg3 (requires member ( >>. ) and member ( >>. ) and member ( >>. ) and member ( >>. ) and member ( >>. ) and member ( .>> ) and member ( >>. ) and member ( <|> ) and member ( .>> ) and member ( |>> ) and member ( .>> ) and member ( |>> ) and member ( .>> ) and member ( <|> ) and member ( .>> ) and member ( |>> ) and member ( .>> ) and member ( |>> ) and member ( .>> ) and member ( |>> ) and member ( |>> ))

Full name: Script.str_ws1
val pstringliteral : '_arg3

Full name: Script.pstringliteral
val s : string
val pidentifier : 'a (requires member ( .>> ) and member ( |>> ) and member ( >>. ) and member ( .>> ) and member ( |>> ) and member ( >>. ) and member ( >>. ) and member ( >>. ) and member ( >>. ) and member ( .>> ) and member ( >>. ) and member ( <|> ) and member ( .>> ) and member ( |>> ) and member ( .>> ) and member ( |>> ) and member ( .>> ) and member ( <|> ) and member ( .>> ) and member ( |>> ) and member ( |>> ))

Full name: Script.pidentifier
val isIdentifierFirstChar : (char -> bool)
val c : char
val isIdentifierChar : (char -> bool)
val pidentifier_ws : '_arg3 (requires member ( .>> ) and member ( |>> ))

Full name: Script.pidentifier_ws
val pvar : '_arg3

Full name: Script.pvar
val x : identifier
val pinvoke : 'a (requires member ( |>> ) and member ( |>> ))

Full name: Script.pinvoke
val pinvokeimpl : 'a ref

Full name: Script.pinvokeimpl
val pfunc : '_arg3

Full name: Script.pfunc
val x : invoke
val plocation : 'a (requires member ( |>> ))

Full name: Script.plocation
val plocationimpl : 'a ref

Full name: Script.plocationimpl
val pgetat : '_arg3

Full name: Script.pgetat
val loc : location
val pvalue : 'a (requires member ( .>> ) and member ( <|> ))

Full name: Script.pvalue
type Assoc = | Associativity

Full name: Script.Assoc
union case Assoc.Associativity: Assoc
val oppa : 'a

Full name: Script.oppa
val parithmetic : 'a (requires member ( .>> ) and member ( >>. ) and member ( >>. ) and member ( <|> ) and member ( .>> ) and member ( >>. ) and member ( >>. ) and member ( >>. ) and member ( >>. ) and member ( |>> ) and member ( .>> ) and member ( |>> ) and member ( .>> ) and member ( <|> ) and member ( .>> ) and member ( |>> ) and member ( .>> ) and member ( |>> ) and member ( .>> ) and member ( |>> ) and member ( |>> ))

Full name: Script.parithmetic
val terma : '_arg3

Full name: Script.terma
val oppc : 'a

Full name: Script.oppc
val pcomparison : 'a (requires member ( .>> ) and member ( >>. ) and member ( <|> ) and member ( >>. ) and member ( >>. ) and member ( >>. ) and member ( >>. ) and member ( .>> ) and member ( >>. ) and member ( <|> ) and member ( .>> ) and member ( |>> ) and member ( .>> ) and member ( |>> ) and member ( .>> ) and member ( |>> ) and member ( .>> ) and member ( |>> ) and member ( .>> ) and member ( |>> ) and member ( |>> ))

Full name: Script.pcomparison
val termc : '_arg3

Full name: Script.termc
val oppl : 'a

Full name: Script.oppl
val plogical : 'a (requires member ( >>. ) and member ( >>. ) and member ( >>. ) and member ( >>. ) and member ( >>. ) and member ( .>> ) and member ( >>. ) and member ( <|> ) and member ( .>> ) and member ( |>> ) and member ( .>> ) and member ( |>> ) and member ( .>> ) and member ( <|> ) and member ( .>> ) and member ( |>> ) and member ( .>> ) and member ( |>> ) and member ( .>> ) and member ( |>> ) and member ( |>> ))

Full name: Script.plogical
val terml : '_arg3

Full name: Script.terml
val pmember : 'a

Full name: Script.pmember
val ptuple : 'a

Full name: Script.ptuple
union case Option.Some: Value: 'T -> Option<'T>
Multiple items
module List

from Microsoft.FSharp.Collections

--------------------
type List<'T> =
  | ( [] )
  | ( :: ) of Head: 'T * Tail: 'T list
  interface IEnumerable
  interface IEnumerable<'T>
  member GetSlice : startIndex:int option * endIndex:int option -> 'T list
  member Head : 'T
  member IsEmpty : bool
  member Item : index:int -> 'T with get
  member Length : int
  member Tail : 'T list
  static member Cons : head:'T * tail:'T list -> 'T list
  static member Empty : 'T list

Full name: Microsoft.FSharp.Collections.List<_>
val toArray : list:'T list -> 'T []

Full name: Microsoft.FSharp.Collections.List.toArray
union case Option.None: Option<'T>
val paction : 'a

Full name: Script.paction
val pset : 'a (requires member ( >>. ) and member ( >>. ) and member ( >>. ) and member ( >>. ) and member ( >>. ) and member ( .>> ) and member ( >>. ) and member ( <|> ) and member ( .>> ) and member ( |>> ) and member ( .>> ) and member ( |>> ) and member ( .>> ) and member ( <|> ) and member ( .>> ) and member ( |>> ) and member ( .>> ) and member ( |>> ) and member ( .>> ) and member ( |>> ) and member ( |>> ))

Full name: Script.pset
val id : x:'T -> 'T

Full name: Microsoft.FSharp.Core.Operators.id
val passign : 'a

Full name: Script.passign
val ppropertyset : 'a

Full name: Script.ppropertyset
val pindex : '_arg3

Full name: Script.pindex
val pindices : 'a

Full name: Script.pindices
val psetat : 'a

Full name: Script.psetat
val pfor : 'a

Full name: Script.pfor
val pfrom : '_arg3
val pto : '_arg6
val pstep : '_arg6
val toStep : (expr option -> expr)
val s : expr
val pendfor : 'a

Full name: Script.pendfor
val pwhile : 'a

Full name: Script.pwhile
val e : expr
val pendwhile : 'a

Full name: Script.pendwhile
val pif : 'a

Full name: Script.pif
val pelseif : 'a

Full name: Script.pelseif
val pelse : 'a

Full name: Script.pelse
val pendif : 'a

Full name: Script.pendif
val psub : 'a

Full name: Script.psub
val name : identifier
val pendsub : 'a

Full name: Script.pendsub
val pgosub : 'a

Full name: Script.pgosub
val routine : identifier
val plabel : 'a

Full name: Script.plabel
Multiple items
val label : label

--------------------
type label = string

Full name: Script.label
val pgoto : 'a

Full name: Script.pgoto
val pinstruct : 'a (requires member ( >>. ) and member ( .>> ) and member ( >>. ) and member ( |>> ) and member ( |>> ))

Full name: Script.pinstruct
val map : mapping:('T -> 'U) -> list:'T list -> 'U list

Full name: Microsoft.FSharp.Collections.List.map
type Line =
  | Blank
  | Instruction of instruction

Full name: Script.Line
union case Line.Blank: Line
union case Line.Instruction: instruction -> Line
val pcomment : '_arg3 (requires member ( <|> ) and member ( .>> ) and member ( >>. ) and member ( |>> ) and member ( |>> ))

Full name: Script.pcomment
val peol : '_arg3 (requires member ( .>> ) and member ( >>. ) and member ( |>> ) and member ( |>> ))

Full name: Script.peol
val pinstruction : '_arg3

Full name: Script.pinstruction
val i : instruction
val pblank : '_arg3

Full name: Script.pblank
val plines : '_arg3

Full name: Script.plines
val parse : program:string -> 'a

Full name: Script.parse
val program : string
val choose : chooser:('T -> 'U option) -> list:'T list -> 'U list

Full name: Microsoft.FSharp.Collections.List.choose
Multiple items
val Failure : message:string -> exn

Full name: Microsoft.FSharp.Core.Operators.Failure

--------------------
active recognizer Failure: exn -> string option

Full name: Microsoft.FSharp.Core.Operators.( |Failure|_| )
val failwith : message:string -> 'T

Full name: Microsoft.FSharp.Core.Operators.failwith
Multiple items
type TextWindow =
  private new : unit -> TextWindow
  static member WriteLine : o:obj -> unit
  static member ForegroundColor : string
  static member ForegroundColor : string with set

Full name: Script.TextWindow

--------------------
private new : unit -> TextWindow
static member TextWindow.WriteLine : o:obj -> unit

Full name: Script.TextWindow.WriteLine
val o : obj
type obj = System.Object

Full name: Microsoft.FSharp.Core.obj
type Console =
  static member BackgroundColor : ConsoleColor with get, set
  static member Beep : unit -> unit + 1 overload
  static member BufferHeight : int with get, set
  static member BufferWidth : int with get, set
  static member CapsLock : bool
  static member Clear : unit -> unit
  static member CursorLeft : int with get, set
  static member CursorSize : int with get, set
  static member CursorTop : int with get, set
  static member CursorVisible : bool with get, set
  ...

Full name: System.Console
System.Console.WriteLine() : unit
   (+0 other overloads)
System.Console.WriteLine(value: string) : unit
   (+0 other overloads)
System.Console.WriteLine(value: obj) : unit
   (+0 other overloads)
System.Console.WriteLine(value: uint64) : unit
   (+0 other overloads)
System.Console.WriteLine(value: int64) : unit
   (+0 other overloads)
System.Console.WriteLine(value: uint32) : unit
   (+0 other overloads)
System.Console.WriteLine(value: int) : unit
   (+0 other overloads)
System.Console.WriteLine(value: float32) : unit
   (+0 other overloads)
System.Console.WriteLine(value: float) : unit
   (+0 other overloads)
System.Console.WriteLine(value: decimal) : unit
   (+0 other overloads)
static member TextWindow.ForegroundColor : string with set

Full name: Script.TextWindow.ForegroundColor
property System.Console.ForegroundColor: System.ConsoleColor
System.Enum.ToString() : string
System.Enum.ToString(format: string) : string
val set : elements:seq<'T> -> Set<'T> (requires comparison)

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.set
val color : string
val color : obj
type Color = System.ConsoleColor

Full name: Script.Color
System.Enum.Parse(enumType: System.Type, value: string) : obj
System.Enum.Parse(enumType: System.Type, value: string, ignoreCase: bool) : obj
val typeof<'T> : System.Type

Full name: Microsoft.FSharp.Core.Operators.typeof
Multiple items
type Clock =
  private new : unit -> Clock
  static member Day : int
  static member Month : int
  static member Year : int

Full name: Script.Clock

--------------------
private new : unit -> Clock
val now : (unit -> System.DateTime)
Multiple items
type DateTime =
  struct
    new : ticks:int64 -> DateTime + 10 overloads
    member Add : value:TimeSpan -> DateTime
    member AddDays : value:float -> DateTime
    member AddHours : value:float -> DateTime
    member AddMilliseconds : value:float -> DateTime
    member AddMinutes : value:float -> DateTime
    member AddMonths : months:int -> DateTime
    member AddSeconds : value:float -> DateTime
    member AddTicks : value:int64 -> DateTime
    member AddYears : value:int -> DateTime
    ...
  end

Full name: System.DateTime

--------------------
System.DateTime()
   (+0 other overloads)
System.DateTime(ticks: int64) : unit
   (+0 other overloads)
System.DateTime(ticks: int64, kind: System.DateTimeKind) : unit
   (+0 other overloads)
System.DateTime(year: int, month: int, day: int) : unit
   (+0 other overloads)
System.DateTime(year: int, month: int, day: int, calendar: System.Globalization.Calendar) : unit
   (+0 other overloads)
System.DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int) : unit
   (+0 other overloads)
System.DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, kind: System.DateTimeKind) : unit
   (+0 other overloads)
System.DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, calendar: System.Globalization.Calendar) : unit
   (+0 other overloads)
System.DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int) : unit
   (+0 other overloads)
System.DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int, kind: System.DateTimeKind) : unit
   (+0 other overloads)
property System.DateTime.Now: System.DateTime
static member Clock.Year : int

Full name: Script.Clock.Year
static member Clock.Month : int

Full name: Script.Clock.Month
static member Clock.Day : int

Full name: Script.Clock.Day
type IMarker

Full name: Script.IMarker
val getLibraryType : name:string -> System.Type

Full name: Script.getLibraryType
val name : string
val fromObj : x:obj -> value

Full name: Script.fromObj


 Converts value to obj
val x : obj
val x : bool
val x : int
val x : double
val x : string
val raise : exn:System.Exception -> 'T

Full name: Microsoft.FSharp.Core.Operators.raise
Multiple items
type NotSupportedException =
  inherit SystemException
  new : unit -> NotSupportedException + 2 overloads

Full name: System.NotSupportedException

--------------------
System.NotSupportedException() : unit
System.NotSupportedException(message: string) : unit
System.NotSupportedException(message: string, innerException: exn) : unit
System.Object.ToString() : string
val toObj : _arg1:value -> obj

Full name: Script.toObj


 Converts value to obj
val box : value:'T -> obj

Full name: Microsoft.FSharp.Core.Operators.box
val x : Hashtable<value,value>
val toInt : _arg1:value -> int

Full name: Script.toInt


 Converts value to int
val toBool : _arg1:value -> bool

Full name: Script.toBool


 Converts value to bool
val toArray : _arg1:value -> Hashtable<value,value>

Full name: Script.toArray


 Converts value to array
val l : double
val r : double
val l : int
val r : int
val compare : lhs:value -> rhs:value -> int

Full name: Script.compare


 Compares values
val lhs : value
val rhs : value
val l : bool
val r : bool
active recognizer AsDoubles: value * value -> (double * double) option

Full name: Script.( |AsDoubles|_| )


 Coerces a tuple of numeric values to double
System.Double.CompareTo(value: float) : int
System.Double.CompareTo(value: obj) : int
val l : string
val r : string
val sprintf : format:Printf.StringFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.sprintf
type VarLookup = Dictionary<identifier,value>

Full name: Script.VarLookup
Multiple items
type Dictionary<'TKey,'TValue> =
  new : unit -> Dictionary<'TKey, 'TValue> + 5 overloads
  member Add : key:'TKey * value:'TValue -> unit
  member Clear : unit -> unit
  member Comparer : IEqualityComparer<'TKey>
  member ContainsKey : key:'TKey -> bool
  member ContainsValue : value:'TValue -> bool
  member Count : int
  member GetEnumerator : unit -> Enumerator<'TKey, 'TValue>
  member GetObjectData : info:SerializationInfo * context:StreamingContext -> unit
  member Item : 'TKey -> 'TValue with get, set
  ...
  nested type Enumerator
  nested type KeyCollection
  nested type ValueCollection

Full name: System.Collections.Generic.Dictionary<_,_>

--------------------
Dictionary() : unit
Dictionary(capacity: int) : unit
Dictionary(comparer: IEqualityComparer<'TKey>) : unit
Dictionary(dictionary: IDictionary<'TKey,'TValue>) : unit
Dictionary(capacity: int, comparer: IEqualityComparer<'TKey>) : unit
Dictionary(dictionary: IDictionary<'TKey,'TValue>, comparer: IEqualityComparer<'TKey>) : unit
val eval : state:VarLookup -> expr:expr -> value

Full name: Script.eval


 Evaluates expressions
val state : VarLookup
Multiple items
val expr : expr

--------------------
type expr =
  | Literal of value
  | Var of identifier
  | GetAt of location
  | Func of invoke
  | Neg of expr
  | Arithmetic of expr * arithmetic * expr
  | Comparison of expr * comparison * expr
  | Logical of expr * logical * expr

Full name: Script.expr


 Small Basic expression
val vars : VarLookup
val x : value
Multiple items
val identifier : identifier

--------------------
type identifier = string

Full name: Script.identifier
Multiple items
val index : expr

--------------------
type index = int

Full name: Script.index
Multiple items
val array : Hashtable<value,value>

--------------------
type 'T array = 'T []

Full name: Microsoft.FSharp.Core.array<_>
val xs : expr list
val call : invoke
Multiple items
val invoke : state:VarLookup -> invoke:invoke -> value

Full name: Script.invoke

--------------------
type invoke =
  | Method of string * string * expr []
  | PropertyGet of string * string

Full name: Script.invoke
val x : expr
Multiple items
val arithmetic : lhs:value -> op:arithmetic -> rhs:value -> value

Full name: Script.arithmetic

--------------------
type arithmetic =
  | Add
  | Subtract
  | Multiply
  | Divide

Full name: Script.arithmetic


 Small Basic arithmetic operation
val l : expr
val op : arithmetic
val r : expr
val op : comparison
Multiple items
val comparison : lhs:value -> op:comparison -> rhs:value -> value

Full name: Script.comparison

--------------------
type comparison =
  | Eq
  | Ne
  | Lt
  | Gt
  | Le
  | Ge

Full name: Script.comparison


 Small Basic comparison operaton
val op : logical
Multiple items
val logical : lhs:value -> op:logical -> rhs:value -> value

Full name: Script.logical

--------------------
type logical =
  | And
  | Or

Full name: Script.logical


 Small Basic logical operation
Multiple items
type NotImplementedException =
  inherit SystemException
  new : unit -> NotImplementedException + 2 overloads

Full name: System.NotImplementedException

--------------------
System.NotImplementedException() : unit
System.NotImplementedException(message: string) : unit
System.NotImplementedException(message: string, inner: exn) : unit
Multiple items
val invoke : invoke

--------------------
type invoke =
  | Method of string * string * expr []
  | PropertyGet of string * string

Full name: Script.invoke
val tn : string
val args : expr []
val t : System.Type
val mi : System.Reflection.MethodInfo
System.Type.GetMethod(name: string) : System.Reflection.MethodInfo
System.Type.GetMethod(name: string, bindingAttr: System.Reflection.BindingFlags) : System.Reflection.MethodInfo
System.Type.GetMethod(name: string, types: System.Type []) : System.Reflection.MethodInfo
System.Type.GetMethod(name: string, types: System.Type [], modifiers: System.Reflection.ParameterModifier []) : System.Reflection.MethodInfo
System.Type.GetMethod(name: string, bindingAttr: System.Reflection.BindingFlags, binder: System.Reflection.Binder, types: System.Type [], modifiers: System.Reflection.ParameterModifier []) : System.Reflection.MethodInfo
System.Type.GetMethod(name: string, bindingAttr: System.Reflection.BindingFlags, binder: System.Reflection.Binder, callConvention: System.Reflection.CallingConventions, types: System.Type [], modifiers: System.Reflection.ParameterModifier []) : System.Reflection.MethodInfo
val args : obj []
val map : mapping:('T -> 'U) -> array:'T [] -> 'U []

Full name: Microsoft.FSharp.Collections.Array.map
System.Reflection.MethodBase.Invoke(obj: obj, parameters: obj []) : obj
System.Reflection.MethodBase.Invoke(obj: obj, invokeAttr: System.Reflection.BindingFlags, binder: System.Reflection.Binder, parameters: obj [], culture: System.Globalization.CultureInfo) : obj
val pi : System.Reflection.PropertyInfo
System.Type.GetProperty(name: string) : System.Reflection.PropertyInfo
System.Type.GetProperty(name: string, returnType: System.Type) : System.Reflection.PropertyInfo
System.Type.GetProperty(name: string, types: System.Type []) : System.Reflection.PropertyInfo
System.Type.GetProperty(name: string, bindingAttr: System.Reflection.BindingFlags) : System.Reflection.PropertyInfo
System.Type.GetProperty(name: string, returnType: System.Type, types: System.Type []) : System.Reflection.PropertyInfo
System.Type.GetProperty(name: string, returnType: System.Type, types: System.Type [], modifiers: System.Reflection.ParameterModifier []) : System.Reflection.PropertyInfo
System.Type.GetProperty(name: string, bindingAttr: System.Reflection.BindingFlags, binder: System.Reflection.Binder, returnType: System.Type, types: System.Type [], modifiers: System.Reflection.ParameterModifier []) : System.Reflection.PropertyInfo
System.Reflection.PropertyInfo.GetValue(obj: obj, index: obj []) : obj
System.Reflection.PropertyInfo.GetValue(obj: obj, invokeAttr: System.Reflection.BindingFlags, binder: System.Reflection.Binder, index: obj [], culture: System.Globalization.CultureInfo) : obj
val run : program:instruction [] -> unit

Full name: Script.run


 Runs program
val program : instruction []
val pi : int ref


 Program index
Multiple items
val ref : value:'T -> 'T ref

Full name: Microsoft.FSharp.Core.Operators.ref

--------------------
type 'T ref = Ref<'T>

Full name: Microsoft.FSharp.Core.ref<_>
val variables : Dictionary<identifier,value>


 Variable lookup
val forLoops : Dictionary<index,(index * identifier * expr * expr)>


 For from EndFor lookup
val whileLoops : Dictionary<index,index>


 While from EndWhile lookup
val callStack : Stack<index>


 Call stack for Gosubs
Multiple items
type Stack<'T> =
  new : unit -> Stack<'T> + 2 overloads
  member Clear : unit -> unit
  member Contains : item:'T -> bool
  member CopyTo : array:'T[] * arrayIndex:int -> unit
  member Count : int
  member GetEnumerator : unit -> Enumerator<'T>
  member Peek : unit -> 'T
  member Pop : unit -> 'T
  member Push : item:'T -> unit
  member ToArray : unit -> 'T[]
  ...
  nested type Enumerator

Full name: System.Collections.Generic.Stack<_>

--------------------
Stack() : unit
Stack(capacity: int) : unit
Stack(collection: IEnumerable<'T>) : unit
val eval : (expr -> value)


 Evaluates expression with variables
Multiple items
val assign : (assign -> unit)


 Assigns variable with result of expression


--------------------
type assign = | Set of identifier * expr

Full name: Script.assign
val propertySet : (string * string * 'a -> 'b)


 Sets property with result of expression
val pn : string
Multiple items
val expr : 'a

--------------------
type expr =
  | Literal of value
  | Var of identifier
  | GetAt of location
  | Func of invoke
  | Neg of expr
  | Arithmetic of expr * arithmetic * expr
  | Comparison of expr * comparison * expr
  | Logical of expr * logical * expr

Full name: Script.expr


 Small Basic expression
System.Reflection.PropertyInfo.SetValue(obj: obj, value: obj, index: obj []) : unit
System.Reflection.PropertyInfo.SetValue(obj: obj, value: obj, invokeAttr: System.Reflection.BindingFlags, binder: System.Reflection.Binder, index: obj [], culture: System.Globalization.CultureInfo) : unit
val obtainArray : (identifier -> Hashtable<value,value>)


 Obtains an array for the specified identifier
Dictionary.TryGetValue(key: identifier, value: byref<value>) : bool
Multiple items
val array : Dictionary<value,value>

--------------------
type 'T array = 'T []

Full name: Microsoft.FSharp.Core.array<_>
type Hashtable<'k,'v> = Dictionary<'k,'v>

Full name: Script.Hashtable<_,_>
Dictionary.Add(key: identifier, value: value) : unit
val setAt : (identifier * expr * expr -> unit)


 Sets array value at index with result of expression
val findFirstIndex : (int -> (instruction -> bool) * (instruction -> bool) -> (instruction -> bool) -> int)


 Finds first index of instructions
val start : int
val inc : (instruction -> bool)
val dec : (instruction -> bool)
val isMatch : (instruction -> bool)
val mutable i : int
val mutable nest : int
val not : value:bool -> bool

Full name: Microsoft.FSharp.Core.Operators.not
val findIndex : (int -> (instruction -> bool) * (instruction -> bool) -> instruction -> int)


 Finds index of instruction
Multiple items
val instruction : instruction

--------------------
type instruction =
  | Assign of assign
  | SetAt of location * expr
  | PropertySet of string * string * expr
  | Action of invoke
  | For of assign * expr * expr
  | EndFor
  | If of expr
  | ElseIf of expr
  | Else
  | EndIf
  ...

Full name: Script.instruction


 Small Basic instruction
val isIf : (instruction -> bool)
val isElseIf : (instruction -> bool)
val isElse : (instruction -> bool)
val isEndIf : (instruction -> bool)
val isFor : (instruction -> bool)
val isEndFor : (instruction -> bool)
val isWhile : (instruction -> bool)
val isEndWhile : (instruction -> bool)
val isFalse : ('a -> bool)
val step : (unit -> unit)


 Instruction step
val set : assign
val ignore : value:'T -> unit

Full name: Microsoft.FSharp.Core.Operators.ignore
val condition : expr
val x : instruction
Multiple items
val index : int

--------------------
type index = int

Full name: Script.index
val from : assign
val target : expr
val step : expr
val start : index
Stack.Push(item: index) : unit
Stack.Pop() : index
property System.Array.Length: int
val incr : cell:int ref -> unit

Full name: Microsoft.FSharp.Core.Operators.incr
val source : string

Full name: Script.source
val program : instruction []

Full name: Script.program

More information

Link:http://fssnip.net/le
Posted:6 years ago
Author:Phillip Trelford
Tags: basic , interpreter , fparsec , parsing , ast