Jump to content

Ameba, an Extensible Meta Programming Language


EdEarl

Recommended Posts

I have started this thread to help cloudzell91 with an idea for a thesis project. He needs more than one to present to his adviser.

 

The original idea came from one of the Knuth "Fundamental Algorithms" volumes, as I recall. I do not have a copy to verify my memory and extract a quote. However, the quote said something to the effect that programming languages cannot modify their own syntax, as spoken languages can. That peaked my curiosity and started me on a lifelong quest to satisfy my curiosity about how it may be done.

 

Several years later, I worked for Datapoint, a minicomputer manufacturer, who had developed a scripting language called CHAINPLUS, which had functions that could get (read) parameters from their call line. Later I worked on Tandem computers and learned a scripting language called TACL, which had functions that got parameters form calls including character-by-character. This process of getting parameters from a call line, instead of functions being passed parameters is essential to making a language that can define functions having any syntax.

 

Although TACL is a scripting language (as BASH) it is also a structured language that with arrays and can be used for rapid prototyping. On the other hand, it is horribly slow when running programs. Ameba is my idea for a language that is both good for rapid prototyping and ultimately capable of being compiled to make fast running programs. Adding the ability for making functions with any syntax gives it the ability be a meta programming language (in other words a language for writing languages), able to make domain specific language extensions, able to do natural language processing, and many other things. To be able to do these things, leads to a requirement for multi-paradigm semantics. And, the requirement for efficient run time leads to the need for partial evaluation of source code, which means functional processing would be a nice addition. Functional processing can lead to a language for proving program correctness.

 

Thus, I think, this thesis can ultimately be developed into a dissertation project. However, a dissertation is too much for a first step. For a thesis project, Ameba does not need all the bells and whistles.

 

------------------------

 

I do not know what you need to present to your adviser. Please ask questions and I will provide more detail, for example:

 

* lexical analysis requirements and design.

* pseudocode requirements and design

* kernel requirements and design

 

I recommend you think about some of the requirements and give me some feedback so that I can better communicate with you.

 

Anyone may ask questions and I will answer.


=============

1) To satisfy requirements as a language for writing languages, Ameba symbols may be any string of characters, including spaces and special characters.

 

2) To run fast requires some lexical preprocessing, but 1) prevents perfect lexical preprocessing. Lexical preprocessing translates from source into pseudocode. Thus, lexical processing requires more than one strategy, including the following:

2A--preprocessing by default rules, assume ASCII

2A1--strings of digits <number>::=<digit>|<digit><number>

2A2--strings of alphabetics <alpha-string>::=<alpha-char>|<alpha-char><alpha-string>

2A3--strings of special characters

2A4--<comment> ::= < /*> <ASCII-string> <*/>

<ASCII-string> ::= <ASCII-character>|<ASCII-character><ASCII-string>

2A6--whitespace: strings of spaces, carriage returns, line feeds, and tabs

2A7--each control character (not strings)

2B--preprocessing by programmer defined rules

2C--preprocessing (either 2A or 2B) and secondary processing

 

NOTE: Backus-Naur Form (BNF) is too limited to describe very much of Ameba. For example,an Ameba function call consists of a function name (i.e., <symbol>) followed by some arbitrary number of characters (i.e., <ASCII-string). That is:

<function>::=<symbol><ASCII-STRING>

However, a function may use the Ameba accumulator, as a calculator uses its accumulator) for a prefix argument, which may be any data type. And, a function parses its argument string however it needs; thus, semantically an Ameba function is more like the following:

<expression-1> <function> <expression-2>

except the expression-1 and expression-2 syntax may be user defined. Thus, addition may be 1+2, 1,2+, (+ 1 2), etc.

 

3) For rapid prototyping, Ameba must have an immediate evaluation mode that is as near to real-time processing as possible.

 

4) To facilitate making functions with any syntax, there may be neither reserved words nor fixed punctuation.

 

5) To satisfy 4) requires an invariant subset of the Ameba pseudocode. Thus several symbols (e.g., - and minus) may be used that translate into the same pseudo-code value.

 

6) Symbols may be overloaded to alter the meaning of a symbol, but the meaning of invariant pseudo-code will not change.

 

7) Secondary lexical processing occurs after preprocessing. Thus, it operates on pseudocode instead of characters. For example, preprocessing does not convert character strings into binary numbers; secondary processing does.



==================

PSEUDOCODE REQUIREMENTS

Ameba pseudocode is vaguely similar to Lisp symbol table, because each entry consists of a symbol and definition similar to a property list.

 

PC-1) Each entry is part of an array with indices 0, 1, 2, .... The index of an entry is the value of the pseudocode for that entry, called a token.

PC-2) Each symbol is a string of tokens.

PC-2) Each definition is a string of tokens.

 

See: http://computer.wikia.com/wiki/The_Design_of_An_Object_Base

 

In my ultimate dream, Ameba would implement a version control system, and source would only be used to make program listings. There would be an integrated development environment (IDE) so that source text would be unnecessary. I have also thought about integrating tests and test suites (e.g., regression testing). But, I am too old to continue and my programming skills are out of date. It would take me a couple of years to learn enough about programming on microprocessors to start coding. It was a hobby that I enjoyed.

 

I could go on, but will stop unless someone asks a question.

Edited by EdEarl
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.