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: 
type label = string
type identifier = string
type index = int
type MethodInfo = System.Reflection.MethodInfo
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 call
    | 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 call =
    | Call of MethodInfo * expr[]
type assign =
    | Set of identifier * expr
type instruction =
    | Assign of assign
    | SetAt of location * expr 
    | Action of call
    | 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: 
open FParsec

type IMarker = interface end

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 = 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 pcall, pcallimpl = createParserForwardedToRef ()
let pfunc = pcall |>> (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 ptuple = between (str_ws "(") (str_ws ")") (sepBy parithmetic (str_ws ",")) |>> (fun xs -> xs)
pcallimpl := 
    pipe4 (pidentifier_ws) (pchar '.') (pidentifier) ptuple 
        (fun tn _ name args -> 
        let t = typeof<IMarker>.DeclaringType.GetNestedType(tn)
        let mi = t.GetMethod(name)
        Call(mi,args |> List.toArray) 
        )

let paction = pcall |>> (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 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 e x s -> For(e, x, 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 |>>  (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 e -> Sub(e))
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;pendfor
        attempt pwhile;pendwhile
        attempt pif;attempt pelseif;pelse;pendif
        attempt psub;pendsub;attempt pgosub 
        attempt paction
        attempt passign        
        attempt plabel;
        attempt pgoto
    ]

let pinstruction = pipe3 ws pchoice eof (fun _ x _ -> x)
let parse (program:string) =
    let lines = program.Split('\n')
                |> Array.filter (fun x -> x.Trim().Length > 0)
    [|for line in lines ->
        match run pinstruction line with
        | Success(result, _, _)   -> result
        | Failure(errorMsg, e, s) -> failwith errorMsg
    |]

Library

1: 
2: 
type TextWindow private () =
    static member WriteLine (o:obj) = System.Console.WriteLine(o)

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: 
/// 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.NotImplementedException())
and invoke state (Call(mi,args)) =
    let args = args |> Array.map (eval state >> toObj)
    mi.Invoke(null, args) |> 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 result of expression to variable
    let assign (Set(identifier,expr)) = variables.[identifier] <- 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 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
        | SetAt(Location(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
        | 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: 
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
    TextWindow.WriteLine("FizzBuzz")  
  Else        
    Dividend = A
    Divisor = 3
    Modulus()
    If Result = 0
    TextWindow.WriteLine("Fizz")
    Else
      Dividend = A
      Divisor = 5
      Modulus()
      If Result = 0
        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 MethodInfo = System.Reflection.MethodInfo

Full name: Script.MethodInfo
namespace System
namespace System.Reflection
type MethodInfo =
  inherit MethodBase
  member Equals : obj:obj -> bool
  member GetBaseDefinition : unit -> MethodInfo
  member GetGenericArguments : unit -> Type[]
  member GetGenericMethodDefinition : unit -> MethodInfo
  member GetHashCode : unit -> int
  member MakeGenericMethod : [<ParamArray>] typeArguments:Type[] -> MethodInfo
  member MemberType : MemberTypes
  member ReturnParameter : ParameterInfo
  member ReturnType : Type
  member ReturnTypeCustomAttributes : ICustomAttributeProvider

Full name: System.Reflection.MethodInfo
type arithmetic =
  | Add
  | Subtract
  | Multiply
  | Divide

Full name: Script.arithmetic
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 call
  | 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: call -> expr
type call = | Call of MethodInfo * expr []

Full name: Script.call
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 call.Call: MethodInfo * expr [] -> call
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
  | Action of call
  | For of assign * expr * expr
  | EndFor
  | If of expr
  | ElseIf of expr
  | Else
  | EndIf
  | While of expr
  ...

Full name: Script.instruction
union case instruction.Assign: assign -> instruction
union case instruction.SetAt: location * expr -> instruction
union case instruction.Action: call -> 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
type IMarker

Full name: Script.IMarker
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,'a>

Full name: Script.ws
val spaces : Parser<unit,'u>

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

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 c : char
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 pcall : Parser<call,unit>

Full name: Script.pcall
val pcallimpl : Parser<call,unit> ref

Full name: Script.pcallimpl
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 : call
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 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 xs : expr list
val pipe4 : Parser<'a,'u> -> Parser<'b,'u> -> Parser<'c,'u> -> Parser<'d,'u> -> ('a -> 'b -> 'c -> 'd -> 'e) -> Parser<'e,'u>

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

Full name: FParsec.CharParsers.pchar
val tn : string
val name : string
val args : expr list
val t : System.Type
val typeof<'T> : System.Type

Full name: Microsoft.FSharp.Core.Operators.typeof
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
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
val paction : Parser<instruction,unit>

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

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

Full name: FParsec.Primitives.pipe3
val id : string
val n : expr
val passign : Parser<instruction,unit>

Full name: Script.passign
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)
union case Option.None: Option<'T>
union case Option.Some: Value: 'T -> Option<'T>
val s : expr
val opt : Parser<'a,'u> -> Parser<'a option,'u>

Full name: FParsec.Primitives.opt
val e : assign
val s : expr option
val pendfor : Parser<instruction,unit>

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

Full name: Script.pwhile
val e : expr
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 e : 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
val pinstruction : Parser<instruction,unit>

Full name: Script.pinstruction
val eof : Parser<unit,'u>

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

Full name: Script.parse
val program : string
val lines : string []
System.String.Split([<System.ParamArray>] separator: char []) : string []
System.String.Split(separator: string [], options: System.StringSplitOptions) : string []
System.String.Split(separator: char [], options: System.StringSplitOptions) : string []
System.String.Split(separator: char [], count: int) : string []
System.String.Split(separator: string [], count: int, options: System.StringSplitOptions) : string []
System.String.Split(separator: char [], count: int, options: System.StringSplitOptions) : string []
module Array

from Microsoft.FSharp.Collections
val filter : predicate:('T -> bool) -> array:'T [] -> 'T []

Full name: Microsoft.FSharp.Collections.Array.filter
System.String.Trim() : string
System.String.Trim([<System.ParamArray>] trimChars: char []) : string
val line : 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 : instruction
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

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)
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 call
  | 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
Multiple items
val call : call

--------------------
type call = | Call of MethodInfo * expr []

Full name: Script.call
val invoke : VarLookup * ArrayLookup -> call -> value

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
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
val mi : MethodInfo
val args : expr []
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 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 result of expression to variable


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

Full name: Script.assign
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
  | Action of call
  | For of assign * expr * expr
  | EndFor
  | If of expr
  | ElseIf of expr
  | Else
  | EndIf
  | While of expr
  ...

Full name: Script.instruction
val isIf : (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
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 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
Next Version Raw view Test code New version

More information

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