Want to try ProtoScript right away?
Use the official GitHub README for the latest syntax reference, runtime notes, and working examples.
At the heart of ProtoScript lies the Prototype system, where every entity is a Prototype—a node in a graph that encapsulates properties, behaviors, and relationships.
Multiple Inheritance
prototype Buffalo_City : City, Location {
Name = "Buffalo";
}
Stored Data (Extensional Facts)
City.State = NewYork_State
Computed Relationships (Intensional Rules)
function IsInState(State state) : bool {
return this.State == state;
}
Prototypes form a directed graph where:
Simple city Modeling
prototype City {
System.String Name = "";
State State = new State();
Name = "New York City";
Collection Cities = new Collection();
// Create bidirectional relationship
City.State.Cities.Add(this);
}
The Simpsons Character Model
prototype Person {
System.String Gender = "";
Location Location = new Location();
Collection ParentOf = new Collection();
Gender = "Male";
System.String Address = "742 Evergreen Terrace";
}
Basic Structure
prototype City {
System.String Name = "";
State State = new State();
Name = "New York City";
Collection Cities = new Collection();
}
Prototype Declaration
prototype Name : Parent1, Parent2 {
// Properties, functions, members
}
Properties (Stored Relationships)
Type Name = DefaultValue;
Functions (Computed Relationships)
function Name(Type parameter) : ReturnType {
// Computed relationship logic
return Result;
}
Annotations
[Lexeme.SingularPlural("city", "cities")]
prototype City {
System.String Name = "";
}
Categorization Operator
prototype -> Type { Condition }
Collections
Collection Cities = new Collection();
int i = 0
and
int j = -1
Output Shadow:
int _ = _
(initialized integer variable pattern)
[SubType]
prototype InitializedIntVariable_SubType : CSharp_VariableDeclaration {
function IsCategorized(CSharp_VariableDeclaration var) : bool {
return var -> CSharp_VariableDeclaration {
this.Type.TypeName == "int" &&
this.Initializer != new CSharp_Expression()
};
}
}
[TransferFunction(NL)]
function Whisper_To_VerbalCommunication(WhisperBase action) : VerbalCommunication {
VerbalCommunication meaning = new VerbalCommunication();
meaning.Volume = "Quiet";
return meaning;
}
prototype CSharp_VariableDeclaration {
CSharp_Type Type = new CSharp_Type();
System.String VariableName = "";
CSharp_Expression Initializer = new CSharp_Expression();
}
prototype SQL_Select {
Collection Columns = new Collection();
SQL_Table Table = new SQL_Table();
System.String Limit = "";
}
prototype Need {
BaseObject Subject = new BaseObject();
Action Object = new Action();
}
System.String, System.Int32
mirror C# primitives
prototype City {
System.String Name = "";
function FormatName() : System.String {
return String.Format("City: {0}", Name);
}
}
Graph Structure
Primitive values (strings, booleans, integers) as graph nodes:
System.String["Buffalo"] // String as graph node