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: 
// Type abbreviations
type label = string
type identifier = string
type index = int
/// 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
/// 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[]
and invoke =
    | Method of string * string * expr[]
    | PropertyGet of string * string
type assign =
    | Set of identifier * expr
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: 
open FParsec

let numberFormat = NumberLiteralOptions.AllowMinusSign ||| 
                   NumberLiteralOptions.AllowFraction ||| 
                   NumberLiteralOptions.AllowExponent                  

let pnumliteral: Parser<expr, unit> =
    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 pvalue = pnumliteral <|> pstringliteral <|> 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)))

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 _ n -> Set(id, n))
let passign = pipe3 (pidentifier_ws) (str_ws "=") (parithmetic) (fun id _ n -> Assign(Set(id, n)))
let ppropertyset = pipe3 pmember (str_ws "=") (parithmetic) (fun (tn,pn) _ e -> PropertySet(tn,pn,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 |>> (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 pchoice =
    choice [
        attempt pfor;attempt pendfor
        attempt pwhile;attempt pendwhile
        attempt pif;attempt pelseif;attempt pelse; attempt pendif
        attempt psub;attempt pendsub;attempt pgosub                 
        attempt ppropertyset
        attempt passign
        attempt paction
        attempt plabel;
        attempt pgoto
    ]

type Line = Blank | Instruction of instruction
let pinstruction = ws >>. pchoice .>> (pchar '\n') |>> (fun i -> Instruction i)
let pblank = ws >>. (pchar '\n') |>> (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 = System.ConsoleColor.Parse(typeof<System.ConsoleColor>, color, true)
            System.Console.ForegroundColor <- color :?> System.ConsoleColor
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: 
/// 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
/// Converts value to int
let toInt = function
    | Bool x -> raise (new System.NotSupportedException())
    | Int x -> x
    | Double x -> int x
    | String x -> int x
/// Converts value to bool
let toBool = function
    | Bool 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>
type ArrayLookup = Dictionary<identifier,Dictionary<value,value>>

/// Evaluates expressions
let rec eval state (expr:expr) =
    let (vars:VarLookup), (arrays:ArrayLookup) = state
    match expr with
    | Literal x -> x
    | Var identifier -> vars.[identifier]
    | GetAt(Location(identifier,[|index|])) -> arrays.[identifier].[eval state index]
    | GetAt(Location(identifier,_)) -> 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()
    /// Array lookup
    let arrays = ArrayLookup()
    /// Current state
    let state = variables, arrays
    /// 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,arrays)
    /// 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)
    /// Sets array value at index with result of expression
    let setAt(identifier,index,expr) =
        let array = 
            match arrays.TryGetValue(identifier) with
            | true, array -> array
            | false, _ -> 
                let array = Dictionary<value,value>()
                arrays.Add(identifier,array)
                array
        array.[eval index] <- eval expr
    /// Finds first index of instructions
    let findFirstIndex start (inc,dec) instructions =
        let mutable i = start
        let mutable nest = 0
        while nest > 0 || instructions |> List.exists ((=) 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(Location(_,_),expr) -> raise (System.NotSupportedException())
        | Action(call) -> invoke state call |> ignore
        | If(condition) ->            
            if eval condition |> toBool |> not then
                let index = findFirstIndex (!pi+1) (isIf, isEndIf) [Else;EndIf]
                pi := index
        | ElseIf(condition) -> raise (System.NotImplementedException())
        | 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: 
32: 
33: 
34: 
35: 
36: 
let source = """
Sub Modulus
  Result = Dividend
  While Result >= Divisor
    Result = Result - Divisor
  EndWhile
EndSub

For A = 1 To 100        
  Dividend = A
  Divisor = 15
  Modulus()
  If Result = 0 Then
    TextWindow.WriteLine("FizzBuzz")  
  Else        
    Dividend = A
    Divisor = 3
    Modulus()
    If Result = 0 Then
    TextWindow.WriteLine("Fizz")
    Else
      Dividend = A
      Divisor = 5
      Modulus()
      If Result = 0 Then
        TextWindow.WriteLine("Buzz")
      Else
        TextWindow.WriteLine(A)        
      EndIf
    EndIf
  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 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

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 -> float (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
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 []

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 [] -> location
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
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
namespace FParsec
val numberFormat : NumberLiteralOptions

Full name: Script.numberFormat
type NumberLiteralOptions =
  | None = 0
  | AllowSuffix = 1
  | AllowMinusSign = 2
  | AllowPlusSign = 4
  | AllowFraction = 8
  | AllowFractionWOIntegerPart = 16
  | AllowExponent = 32
  | AllowHexadecimal = 64
  | AllowBinary = 128
  | AllowOctal = 256
  | AllowInfinity = 512
  | AllowNaN = 1024
  | IncludeSuffixCharsInString = 2048
  | DefaultInteger = 454
  | DefaultUnsignedInteger = 448
  | DefaultFloat = 1646

Full name: FParsec.CharParsers.NumberLiteralOptions
NumberLiteralOptions.AllowMinusSign: NumberLiteralOptions = 2
NumberLiteralOptions.AllowFraction: NumberLiteralOptions = 8
NumberLiteralOptions.AllowExponent: NumberLiteralOptions = 32
val pnumliteral : Parser<expr,unit>

Full name: Script.pnumliteral
type Parser<'Result,'UserState> = CharStream<'UserState> -> Reply<'Result>

Full name: FParsec.Primitives.Parser<_,_>
type unit = Unit

Full name: Microsoft.FSharp.Core.unit
val numberLiteral : NumberLiteralOptions -> string -> Parser<NumberLiteral,'u>

Full name: FParsec.CharParsers.numberLiteral
val nl : NumberLiteral
property NumberLiteral.IsInteger: bool
property NumberLiteral.String: string
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 : Parser<unit,unit>

Full name: Script.ws
val skipManySatisfy : (char -> bool) -> Parser<unit,'u>

Full name: FParsec.CharParsers.skipManySatisfy
val c : char
val str_ws : s:string -> Parser<string,unit>

Full name: Script.str_ws
val s : string
val pstring : string -> Parser<string,'u>

Full name: FParsec.CharParsers.pstring
val str_ws1 : s:string -> Parser<string,'a>

Full name: Script.str_ws1
val spaces1 : Parser<unit,'u>

Full name: FParsec.CharParsers.spaces1
val pstringliteral : Parser<expr,unit>

Full name: Script.pstringliteral
val between : Parser<'a,'u> -> Parser<'b,'u> -> Parser<'c,'u> -> Parser<'c,'u>

Full name: FParsec.Primitives.between
val manySatisfy : (char -> bool) -> Parser<string,'u>

Full name: FParsec.CharParsers.manySatisfy
val x : char
val pidentifier : Parser<string,unit>

Full name: Script.pidentifier
val isIdentifierFirstChar : (char -> bool)
val isLetter : char -> bool

Full name: FParsec.CharParsers.isLetter
val isIdentifierChar : (char -> bool)
val isDigit : char -> bool

Full name: FParsec.CharParsers.isDigit
val many1Satisfy2L : (char -> bool) -> (char -> bool) -> string -> Parser<string,'u>

Full name: FParsec.CharParsers.many1Satisfy2L
val pidentifier_ws : Parser<string,unit>

Full name: Script.pidentifier_ws
val pvar : Parser<expr,unit>

Full name: Script.pvar
val x : string
val pinvoke : Parser<invoke,unit>

Full name: Script.pinvoke
val pinvokeimpl : Parser<invoke,unit> ref

Full name: Script.pinvokeimpl
val createParserForwardedToRef : unit -> Parser<'a,'u> * Parser<'a,'u> ref

Full name: FParsec.Primitives.createParserForwardedToRef
val pfunc : Parser<expr,unit>

Full name: Script.pfunc
val x : invoke
val pvalue : Parser<expr,unit>

Full name: Script.pvalue
val attempt : Parser<'a,'u> -> Parser<'a,'u>

Full name: FParsec.Primitives.attempt
type Assoc = Associativity

Full name: Script.Assoc
type Associativity =
  | None = 0
  | Left = 1
  | Right = 2

Full name: FParsec.Associativity
val oppa : OperatorPrecedenceParser<expr,unit,unit>

Full name: Script.oppa
Multiple items
type OperatorPrecedenceParser<'TTerm,'TAfterString,'TUserState> =
  inherit FSharpFunc<CharStream<'TUserState>, Reply<'TTerm>>
  new : unit -> OperatorPrecedenceParser<'TTerm, 'TAfterString, 'TUserState>
  member AddOperator : op:Operator<'TTerm, 'TAfterString, 'TUserState> -> unit
  member ExpressionParser : FSharpFunc<CharStream<'TUserState>, Reply<'TTerm>>
  member Invoke : stream:CharStream<'TUserState> -> Reply<'TTerm>
  member MissingTernary2ndStringErrorFormatter : FSharpFunc<Tuple<Position, Position, TernaryOperator<'TTerm, 'TAfterString, 'TUserState>, 'TAfterString>, ErrorMessageList> with get, set
  member OperatorConflictErrorFormatter : FSharpFunc<Tuple<Position, Operator<'TTerm, 'TAfterString, 'TUserState>, 'TAfterString>, FSharpFunc<Tuple<Position, Operator<'TTerm, 'TAfterString, 'TUserState>, 'TAfterString>, ErrorMessageList>> with get, set
  member Operators : IEnumerable<Operator<'TTerm, 'TAfterString, 'TUserState>>
  member RemoveInfixOperator : opString:string -> bool
  member RemoveOperator : op:Operator<'TTerm, 'TAfterString, 'TUserState> -> bool
  member RemovePostfixOperator : opString:string -> bool
  ...

Full name: FParsec.OperatorPrecedenceParser<_,_,_>

--------------------
OperatorPrecedenceParser() : unit
val parithmetic : (CharStream<unit> -> Reply<expr>)

Full name: Script.parithmetic
property OperatorPrecedenceParser.ExpressionParser: CharStream<unit> -> Reply<expr>
val terma : Parser<expr,unit>

Full name: Script.terma
property OperatorPrecedenceParser.TermParser: CharStream<unit> -> Reply<expr>
OperatorPrecedenceParser.AddOperator(op: Operator<expr,unit,unit>) : unit
Multiple items
type InfixOperator<'TTerm,'TAfterString,'TUserState> =
  inherit Operator<'TTerm, 'TAfterString, 'TUserState>
  new : operatorString:string * afterStringParser:FSharpFunc<CharStream<'TUserState>, Reply<'TAfterString>> * precedence:int * associativity:Associativity * mapping:FSharpFunc<'TTerm, FSharpFunc<'TTerm, 'TTerm>> -> InfixOperator<'TTerm, 'TAfterString, 'TUserState> + 1 overload

Full name: FParsec.InfixOperator<_,_,_>

--------------------
InfixOperator(operatorString: string, afterStringParser: CharStream<'TUserState> -> Reply<'TAfterString>, precedence: int, associativity: Associativity, mapping: 'TTerm -> 'TTerm -> 'TTerm) : unit
InfixOperator(operatorString: string, afterStringParser: CharStream<'TUserState> -> Reply<'TAfterString>, precedence: int, associativity: Associativity, dummy: Unit, mapping: 'TAfterString -> 'TTerm -> 'TTerm -> 'TTerm) : unit
field Associativity.Left = 1
val x : expr
val y : expr
val oppc : OperatorPrecedenceParser<expr,unit,unit>

Full name: Script.oppc
val pcomparison : (CharStream<unit> -> Reply<expr>)

Full name: Script.pcomparison
val termc : Parser<expr,unit>

Full name: Script.termc
val oppl : OperatorPrecedenceParser<expr,unit,unit>

Full name: Script.oppl
val plogical : (CharStream<unit> -> Reply<expr>)

Full name: Script.plogical
val terml : Parser<expr,unit>

Full name: Script.terml
val pmember : Parser<(string * string),unit>

Full name: Script.pmember
val pipe3 : Parser<'a,'u> -> Parser<'b,'u> -> Parser<'c,'u> -> ('a -> 'b -> 'c -> 'd) -> Parser<'d,'u>

Full name: FParsec.Primitives.pipe3
val pchar : char -> Parser<char,'u>

Full name: FParsec.CharParsers.pchar
val tn : string
val mn : string
val ptuple : Parser<expr list,unit>

Full name: Script.ptuple
val sepBy : Parser<'a,'u> -> Parser<'b,'u> -> Parser<'a list,'u>

Full name: FParsec.Primitives.sepBy
val pipe2 : Parser<'a,'u> -> Parser<'b,'u> -> ('a -> 'b -> 'c) -> Parser<'c,'u>

Full name: FParsec.Primitives.pipe2
val opt : Parser<'a,'u> -> Parser<'a option,'u>

Full name: FParsec.Primitives.opt
val args : expr list option
union case Option.Some: Value: 'T -> Option<'T>
val args : expr list
Multiple items
module List

from Microsoft.FSharp.Collections

--------------------
type List<'T> =
  | ( [] )
  | ( :: ) of Head: 'T * Tail: 'T list
  interface IEnumerable
  interface IEnumerable<'T>
  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 : Parser<instruction,unit>

Full name: Script.paction
val pset : Parser<assign,unit>

Full name: Script.pset
val id : string
val n : expr
val passign : Parser<instruction,unit>

Full name: Script.passign
val ppropertyset : Parser<instruction,unit>

Full name: Script.ppropertyset
val pn : string
val e : expr
val pfor : Parser<instruction,unit>

Full name: Script.pfor
val pfrom : Parser<assign,unit>
val pto : Parser<expr,unit>
val pstep : Parser<expr,unit>
val toStep : (expr option -> expr)
val s : expr
val f : assign
val t : expr
val s : expr option
val pendfor : Parser<instruction,unit>

Full name: Script.pendfor
val pwhile : Parser<instruction,unit>

Full name: Script.pwhile
val pendwhile : Parser<instruction,unit>

Full name: Script.pendwhile
val pif : Parser<instruction,unit>

Full name: Script.pif
val pelseif : Parser<instruction,unit>

Full name: Script.pelseif
val pelse : Parser<instruction,unit>

Full name: Script.pelse
val pendif : Parser<instruction,unit>

Full name: Script.pendif
val psub : Parser<instruction,unit>

Full name: Script.psub
val name : string
val pendsub : Parser<instruction,unit>

Full name: Script.pendsub
val pgosub : Parser<instruction,unit>

Full name: Script.pgosub
val routine : string
val plabel : Parser<instruction,unit>

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

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

Full name: Script.label
val pgoto : Parser<instruction,unit>

Full name: Script.pgoto
val pchoice : (CharStream<unit> -> Reply<instruction>)

Full name: Script.pchoice
val choice : seq<Parser<'a,'u>> -> Parser<'a,'u>

Full name: FParsec.Primitives.choice
type Line =
  | Blank
  | Instruction of instruction

Full name: Script.Line
union case Line.Blank: Line
union case Line.Instruction: instruction -> Line
val pinstruction : Parser<Line,unit>

Full name: Script.pinstruction
val i : instruction
val pblank : Parser<Line,unit>

Full name: Script.pblank
val plines : Parser<Line list,unit>

Full name: Script.plines
val many : Parser<'a,'u> -> Parser<'a list,'u>

Full name: FParsec.Primitives.many
val eof : Parser<unit,'u>

Full name: FParsec.CharParsers.eof
val parse : program:string -> instruction []

Full name: Script.parse
val program : string
val run : Parser<'Result,unit> -> string -> ParserResult<'Result,unit>

Full name: FParsec.CharParsers.run
union case ParserResult.Success: 'Result * 'UserState * Position -> ParserResult<'Result,'UserState>
val result : Line list
val choose : chooser:('T -> 'U option) -> list:'T list -> 'U list

Full name: Microsoft.FSharp.Collections.List.choose
union case ParserResult.Failure: string * ParserError * 'UserState -> ParserResult<'Result,'UserState>
val errorMsg : string
val e : ParserError
val s : unit
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
namespace System
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 ConsoleColor =
  | Black = 0
  | DarkBlue = 1
  | DarkGreen = 2
  | DarkCyan = 3
  | DarkRed = 4
  | DarkMagenta = 5
  | DarkYellow = 6
  | Gray = 7
  | DarkGray = 8
  | Blue = 9
  ...

Full name: System.ConsoleColor
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 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 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 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 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
namespace System.Collections
namespace System.Collections.Generic
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
Multiple items
val identifier : IdentifierOptions -> Parser<string,'u>

Full name: FParsec.CharParsers.identifier

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

Full name: Script.identifier
type ArrayLookup = Dictionary<identifier,Dictionary<value,value>>

Full name: Script.ArrayLookup
val eval : VarLookup * ArrayLookup -> expr:expr -> value

Full name: Script.eval


 Evaluates expressions
val state : VarLookup * ArrayLookup
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 arrays : ArrayLookup
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
val call : invoke
Multiple items
val invoke : VarLookup * ArrayLookup -> invoke:invoke -> value

Full name: Script.invoke

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

Full name: Script.invoke
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 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 []
module Array

from Microsoft.FSharp.Collections
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 arrays : Dictionary<identifier,Dictionary<value,value>>


 Array lookup
val state : Dictionary<identifier,value> * Dictionary<identifier,Dictionary<value,value>>


 Current state
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
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 setAt : (identifier * expr * expr -> unit)


 Sets array value at index with result of expression
Multiple items
val array : Dictionary<value,value>

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

Full name: Microsoft.FSharp.Core.array<_>
Dictionary.TryGetValue(key: identifier, value: byref<Dictionary<value,value>>) : bool
Dictionary.Add(key: identifier, value: Dictionary<value,value>) : unit
val findFirstIndex : (int -> (instruction -> bool) * (instruction -> bool) -> instruction list -> int)


 Finds first index of instructions
val start : int
val inc : (instruction -> bool)
val dec : (instruction -> bool)
val instructions : instruction list
val mutable i : int
val mutable nest : int
Multiple items
type List<'T> =
  new : unit -> List<'T> + 2 overloads
  member Add : item:'T -> unit
  member AddRange : collection:IEnumerable<'T> -> unit
  member AsReadOnly : unit -> ReadOnlyCollection<'T>
  member BinarySearch : item:'T -> int + 2 overloads
  member Capacity : int with get, set
  member Clear : unit -> unit
  member Contains : item:'T -> bool
  member ConvertAll<'TOutput> : converter:Converter<'T, 'TOutput> -> List<'TOutput>
  member CopyTo : array:'T[] -> unit + 2 overloads
  ...
  nested type Enumerator

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

--------------------
List() : unit
List(capacity: int) : unit
List(collection: IEnumerable<'T>) : unit
val exists : predicate:('T -> bool) -> list:'T list -> bool

Full name: Microsoft.FSharp.Collections.List.exists
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
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
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
Multiple items
val label : label

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

Full name: Script.label
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