Graph-based programming language
Welcome to the Future of
Knowledge Representation
ProtoScript is a powerful, graph-based programming language developed by
Matt Furnari to model and manipulate complex relationships in a flexible, dynamic way.
Designed for the Buffaly system, ProtoScript offers developers a fresh paradigm that blends
object-oriented structure with graph-based knowledge representation.
Fundamentals
Advanced Topics
Integration
What is Protoscript?
A Declarative, Prototype-Oriented Language
ProtoScript is a declarative, prototype-oriented language designed to work within the Buff aly system—a framework for representing knowledge as graphs. Unlike traditional programming languages that rely on rigid class hierarchies, ProtoScript uses Prototypes as versatile entities that act as both templates and instances.
Code Structures
Representing C# variable declarations (int i = 0) or SQL queries
Natural Language
Parsing sentences like "I need to buy some covid-19 test kits" into semantic graphs
Abstract Concepts
Modeling relationships like "New York City is in New York State"
Developer-Friendly Design
Think of ProtoScript as a blend of C#'s structured syntax and a database's relational power, but with the flexibility of a graph database like Neo4j
Analogies for developers
Familiar Concepts, Graph-Based Power
For C# Developers 

● Classes → Prototypes (inherit from multiple parents, change at runtime)
● Objects → Graph nodes (represent variables, queries, or concepts)
● Methods → Functions (traverse or modify the graph)

For JavaScript Developers ProtoScript's prototype-based nature resembles JavaScript's prototypal inheritance, but with stronger focus on graph operations and symbolic computation. 


For Database Developers Similar to graph database nodes with properties and relationships, but with programmable behaviors integrated into the language.
The prototype system
Dynamic Entities in a Graph Structure

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.

Core Characteristics

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;
				
				}
				
			

Graph Structure

Prototypes form a directed graph where:

  • Nodes represent Prototypes
  • Edges represent inheritance, properties, or computed links
  • Cycles are allowed in property relationships
Built for flexibility
Six Key Objectives
Practical implementations for real-world scenarios.
1. Simplified Graph Creation
Reduce boilerplate compared to verbose class definitions
2. Multiple Inheritance
Reflect real-world complexity where entities belong to multiple categories
3. Stored and Computed Relationships
Combine database-like facts with logic rules
4. Native Graph Operations
Native Graph Operations - Built-in tools for traversing and manipulating graphs
5. Serialization-First
Easy storage and sharing across systems
6. Runtime Modifications
Adapt at runtime unlike static type systems
Where protoscript excels
Real-World Applications
Natural Language Processing Parse sentences into semantic graphs for AI applications

Code Analysis and Transformation
● Refactor code (string s1 = "" to string s1 = string.Empty)
● Generate code from natural language descriptions

Knowledge Representation
Build ontologies for domains like geography or fi ctional universes

Cross-Domain Integration Connect code structures, databases, and natural language in unifi ed graphs
Seeing Protoscript in Action

Simple city Modeling

				
				
				prototype City {
				
				
				    System.String Name = 
				
				
				""
				
				
				;
				
				
				    State State = 
				
				
				new
				
				
				 State();
				
				}
				prototype NewYork_City : City {
				
				    Name = 
				
				
				"New York City"
				
				
				;
				
				}
				prototype State {
				
				    Collection Cities = 
				
				
				new
				
				
				 Collection();
				
				}
				
				
				
				// Create bidirectional relationship
				
				
				
				NewYork_City.State = NewYork_State;
				NewYork_State.Cities = [NewYork_City];
				
			

The Simpsons Character Model

				
				
				prototype Person {
				
				
				    System.String Gender = 
				
				
				""
				
				
				;
				
				
				    Location Location = 
				
				
				new
				
				
				 Location();
				
				
				    Collection ParentOf = 
				
				
				new
				
				
				 Collection();
				
				}
				prototype Homer : Person {
				
				    Gender = 
				
				
				"Male"
				
				
				;
				
				    Location = SimpsonsHouse;
				    ParentOf = [Bart, Lisa, Maggie];
				}
				prototype SimpsonsHouse : Location {
				
				    System.String Address = 
				
				
				"742 Evergreen Terrace"
				
				
				;
				
				}
				
			
Protoscript vs. Traditional Ontologies
Dynamic, Developer-Friendly Knowledge Representation
Feature
Traditional Ontology
(OWL/RDF)
ProtoScript
Concept Definition
Static classes
Dynamic prototypes
Inheritance
Rigid hierarchies
Flexible, multiple inheritance
Runtime Adaptation
Difficult
Native support
Reasoning Model
Axioms + inference engines
Structural generalization
Best Used For
Interoperable semantic
layers
Evolving, explainable knowledge graphs

Key Advantages

  • Prototype-Based Structure instead of rigid class hierarchies
  • Graph-Native Relationships not limited to taxonomic structures
  • Lightweight Reasoning through structural generalization vs. complex axioms
  • Runtime Flexibility for evolving knowledge bases
Language fundamentals
C#-Inspired Syntax for Graph Programming

Basic Structure

					
					
					prototype City {
					
					
					    System.String Name = 
					
					
					""
					
					
					;
					
					
					    State State = 
					
					
					new
					
					
					 State();
					
					}
					
				

Core Language Features

Prototype Declaration

					
					
					prototype Name : Parent1, Parent2 {
					
					
					
					
					// Properties, functions, members
					
					
					
					}
					
				

Properties (Stored Relationships)

					
					
					Type Name = DefaultValue;
					
					
				

Functions (Computed Relationships)

					
					
					function
					
					
					
					
					Name
					
					
					(
					
					
					Parameters
					
					
					) : 
					
					
					ReturnType
					
					
					
					
					{
					
					
					
					
					// Graph operations
					
					
					
					}
					
				

Annotations

					
					
					[Lexeme.SingularPlural(
					
					
					"city"
					
					
					, 
					
					
					"cities"
					
					
					)]
					
					prototype City { ... }
					
				

Categorization Operator

					
					
					prototype -> Type { Condition }
					
					
				

Collections

					
					
					Collection Cities = 
					
					
					new
					
					
					 Collection();
					
					
				
Advanced capabilities
Shadows and Least General Generalization ( LGG )
Shadows are ProtoScript's primary learning mechanism—creating ad-hoc subtypes that generalize common structures across Prototypes.
How LGG Works
1. Compare two Prototypes' structures
2. Retain identical properties and values
3. Generalize diff ering values to common types
4. Output a Shadow representing shared structure

Example : Generalizing Variable Declarations
Input: int i = 0 and int j = -1 Output Shadow: int _ = _ (initialized integer variable pattern)
Subtypes
Dynamic reclassifi cation of Prototypes at runtime using context-sensitive conditions.
			
			
			[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()
			
			        };
			    }
			}
			
		
Transformation Functions
Runtime-driven operations that map one Prototype to another across domains.
			
			
			[TransferFunction(NL)]
			
			
			
			
			function
			
			
			
			
			Whisper_To_VerbalCommunication
			
			
			(
			
			
			WhisperBase action
			
			
			) : 
			
			
			VerbalCommunication
			
			
			
			
			{
			
			
			    VerbalCommunication meaning = 
			
			
			new
			
			
			 VerbalCommunication();
			
			    meaning.SourceActor = action.Subject;
			
			    meaning.Volume = 
			
			
			"Quiet"
			
			
			;
			
			
			
			
			return
			
			
			 meaning;
			
			}
			
		
Unifying diverse domains
One Graph , Multiple Data Types
ProtoScript's universal representation enables modeling any data type—C# code, SQL queries, database objects, or natural language—as interconnected Prototypes.
Code Structure Example
			
			
			prototype CSharp_VariableDeclaration {
			
			
			    CSharp_Type Type = 
			
			
			new
			
			
			 CSharp_Type();
			
			
			    System.String VariableName = 
			
			
			""
			
			
			;
			
			
			    CSharp_Expression Initializer = 
			
			
			new
			
			
			 CSharp_Expression();
			
			}
			
		
SQL Query Example
			
			
			prototype SQL_Select {
			
			
			    Collection Columns = 
			
			
			new
			
			
			 Collection();
			
			
			    SQL_Table Table = 
			
			
			new
			
			
			 SQL_Table();
			
			
			    System.String Limit = 
			
			
			""
			
			
			;
			
			}
			
		
Natural Language Example
			
			
			prototype Need {
			
			
			    BaseObject Subject = 
			
			
			new
			
			
			 BaseObject();
			
			
			    Action 
			
			
			Object
			
			
			 = 
			
			
			new
			
			
			 Action();
			
			}
			
		
Innovate
Cross-Domain Transformations
By unifying data types in a graph, ProtoScript enables transformations like:

● Natural language → SQL queries
● C# variables → Database columns None
● Code structures → Semantic models
Prerequisites
What You Need to Know
ProtoScript's universal representation enables modeling any data type—C# code, SQL queries, database objects, or natural language—as interconnected Prototypes.
Required Knowledge
● Object-Oriented Programming: Familiarity with classes, objects, and inheritance
● Graph Concepts: Basic understanding of nodes and edges
● C# Syntax: ProtoScript uses C#-inspired syntax

No Experience Needed
● Graph-based languages
● Traditional ontology tools
● Complex mathematical concepts
Seamless C# integration
Native Interoperability
ProtoScript integrates seamlessly with C#:
Native Types
System.String, System.Int32 mirror C# primitives
Runtime Calls
Functions can invok
C# methods
Type Conversions:
Automatic mapping between ProtoScript and C# types
			
			
			prototype City {
			
			
			    System.String Name = 
			
			
			""
			
			
			;
			
			
			
			
			function
			
			
			
			
			FormatName
			
			
			(
			
			
			) : 
			
			
			System
			
			
			.
			
			
			String
			
			
			
			
			{
			
			
			
			
			return
			
			
			
			
			String
			
			
			.Format(
			
			
			"City: {0}"
			
			
			, Name);
			
			    }
			}
			
		
Manual organization
Incremental Learning Structure
Diverse implementation scenarios across multiple domains
1. Core Concepts
Semantic modeling for complex scientific research environments
2. Relationships
Intelligent system design techniques
3. Operational Constructs
Advanced computational modeling for large-scale data systems
4. Advanced Topics
Dynamic prototype generation for intelligent robotic frameworks
5. Examples and Integration
Advanced linguistic modeling techniques
Under the hood
Runtime Architecture

Graph Structure

  • Nodes: Prototypes with unique identifiers
  • Edges: Inheritance (isa), properties, computed relationships
  • Runtime: Manages instantiation, traversal, and execution

Performance Characteristics

  • Scalable: Sub-linear scaling with efficient pairwise comparisons
  • Interpretable: Explicit graph paths for all operations
  • Deterministic: Predictable results unlike gradient descent approaches

NativeValuePrototypes

Primitive values (strings, booleans, integers) as graph nodes:

				
				
				System.String[
				
				
				"Buffalo"
				
				
				] 
				
				
				// String as graph node
				
				
				
				
				System.Boolean[True]     
				
				
				// Boolean as graph node  
				
				
				
				
				System.Int32[
				
				
				42
				
				
				]         
				
				
				// Integer as graph node