User:Thepigdog/vsoom

From Knowino
Jump to: navigation, search

Value Set, Object Oriented, Meta Programming Language (VSOOM).

I dont want to define a language. I see development tools as interacting directly with the meta object model of the program. That is, the IDE provides a GUI for editing the programs.

But the GUI still needs to display the program as text, and I need to describe the program as text. So I need a language.

Basically I will start with Java and add a few features. Actually I think Wirth got the type definitions right in the Pascal language but we are all used to C style declarations now.

Contents

[edit] Language Features

Header text Header text Header text
Feature Example Description
Value Sets unique and multiple data type qualifiers unique, multiple
OO class Shape { } class
Scoping Scope { } scope
Demand driven evaluation in out data type modifiers in, out
Roles role parameter modifier role, as
Renaming inheritance inherit Attribute as Name inherit, as
Function renaming T Get() rename as Get% rename, as
Name sharing (value combination) String GetAttributeNames() combine CommaCombine combine
Pointer inheritance (proxy classes) CtrlTrade inherit proxy Trade proxy
Dynamic inheritance CtrlTrade inherit dynamic Trade dynamic
Ranges and mappings long[1..5]
Generics and type parameters Sort(class T : Vector, class O : Order) class
services service class IdGenerator { mutable long m_id; muted Id CreateId()} service, mutable, muted
Returning the result result = 5 * 6 result, return

[edit] Summary

Borrowing from Java, there are no pointers. All member variables to objects are implicitly pointers. However renaming inheritance allows the composition of classes.

void functions will usually be replaced by bool functions. A function like,


Java VSOOM Using result
void Wash(Dog dog)
{
    FillBath();
    PutDogInBath();
}
bool Wash(Dog dog)
{
    FillBath() and PutDogInBath()
}
bool Wash(Dog dog)
{
    result =FillBath() and PutDogInBath()
}

There are no sides effects (except in services) and there is no implicit order of evaluation. Evaluation is demand driven, which means that calculations are made only to evaluate results required externally.

Imperative style programs and programs that deal with change may be written using "roles" which hide the explicit passing of the time in variables.

Renaming inheritance allows the implementation of "has a" relationships, as well as "is a" relationships.

[edit] Language Elements

[edit] MetaBlock

[edit] MetaPathName

[edit] class

Header text Header text

BNF

 <Class-Declaration> ::= class <PathName> <Inheritance> <Block>

Attributes

 inherit Attibute(MetaPathName) as Name;
 inherit Attibute(MetaBlock) as Block;
 inherit Vector(MetaInherit) as InheritList;

Generator

 String Generate()
 {
   "class" + Space() + GetName() + Space()
   InheritanceDeclaration() +
   "{" + 
       Space() + InheritanceStatements() +
       Space() + GetBlock()->Generate() + Space()
   "}" 
 }
Personal tools
Namespaces
Variants
Actions
Navigation
Community
Toolbox