Last active
June 8, 2016 23:03
-
-
Save bryanedds/33f75ad3bd3374c7d4e412cee33b09ec to your computer and use it in GitHub Desktop.
Visually-Scripted Reactive Language (VSRL) - Prototype
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Nu Game Engine. | |
// Copyright (C) Bryan Edds, 2012-2016. | |
namespace Nu | |
open System | |
open System.Collections.Generic | |
open System.Runtime.InteropServices | |
open OpenTK | |
open Prime | |
/// A Visually-Scripted Reactive Language - A scripting language for Nu that is essentially cross between Elm and | |
/// Unreal Blueprints. | |
module Vsrl = | |
type [<NoComparison>] Referent = | |
| TickTime | |
| EyeCenter | |
| Simulant of obj Address | |
type [<NoComparison>] Metadata = | |
{ Documentation : string | |
BreakpointEnabled : bool | |
BreakpointCondition : Expr } | |
and [<NoComparison>] Lambda = | |
| Not of Expr | |
| And of Expr * Expr | Or of Expr * Expr | |
| Equal of Expr * Expr | NotEqual of Expr * Expr | Less of Expr * Expr | Greater of Expr * Expr | LessOrEqual of Expr * Expr | GreaterOrEqual of Expr * Expr | |
| Add of Expr * Expr | Subtract of Expr * Expr | Multiply of Expr * Expr | Divide of Expr * Expr | Rem of Expr * Expr | Mod of Expr * Expr | Pow of Expr * Expr | |
| Floor of Expr | Ceiling of Expr | Truncate of Expr | Round of Expr | |
| Exp of Expr | Log of Expr | Square of Expr | Sqrt of Expr | |
| Sin of Expr | Cos of Expr | Tan of Expr | Asin of Expr | Acos of Expr | Atan of Expr | |
| Cross of Expr * Expr | Dot of Expr * Expr | Length of Expr | Normal of Expr | |
| Head of Expr | Tail of Expr | Cons of Expr * Expr | |
| Map of Expr * Expr | Filter of Expr * Expr | Fold of Expr * Expr * Expr | Any of Expr | All of Expr | None of Expr | |
| Property of string * Referent | |
| If of Expr * Expr * Expr | |
| Try of Expr * Expr | |
| Fun of string list * Expr * int | |
and [<NoComparison>] Value = | |
| Boolean of bool | |
| Integer of int | |
| Integer64 of int64 | |
| Single of single | |
| Double of double | |
| String of string | |
| Vector2 of Vector2 | |
| Violation of string | |
| Reference of Referent | |
| Lambda of Lambda | |
and [<NoComparison>] Expr = | |
| Value of Value * Metadata | |
| Exprs of Expr list * Metadata * int | |
static member getMetadata expr = | |
match expr with | |
| Value (_, data) -> data | |
| Exprs (_, data, _) -> data | |
type [<NoComparison>] Declaration = | |
{ DeclName : string | |
DeclValue : Expr } | |
type [<NoEquality; NoComparison>] Env = | |
private | |
{ Globals : Dictionary<string, Declaration> | |
Assignments : Referent * Expr | |
Variables : Value list | |
Debugging : bool } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment