Menu

Project Structure

Trevor Tiernan

The project works as follows :

All the "Story Programming Language" words are processed into lists. That is all the Noun (Object) types are separated out, verbs (functions) are separated out, etc. These lists are then used in determining the "type" of the words in the primary code files.
This separating is done by an initial scan of the "dictionary" files. That is Story's idea of a class file.

Next, there is a translation unit which translates the "Story" (code) into an object oriented form. This could be done by first matching up the Story tokens with their respective grammatical type. (as detailed above). Then a grammar checker (Story is initially using a simple easily verifiable grammar) to check that the token orderings are correct.
Afterword a simple lookup for the words definition is done. These definitions will be in either Story or explicitly defined in Java for operations like Console writing. This allows Story to define itself, but call upon its version of assembly (in this case Java) to perform the basic operations.

Finally, there is a Java "code printer" which takes the essentially complete translation
and output it as properly formatted Java code instead of high level constructs like objects and functions directly (which would be more like an abstract syntax tree). This functions as the primary backend component.

As an example,

For instance we might have sentences like this. (A line of code in Story is called a sentence also).

"Mikey is a car."
"Mikey is self driving."
Might be translated as follows.

Noun - Mikey
is - keyword (Translated as a type declaration, or prepares for another verb, our definition of words can branch).
a - adjective, absorbed by the type declaration or by the compiler.
car - noun, type.

Mikey - noun
is - announces a verb is coming
self - adverb (a variable going into the function)
driving - synonym of drove // a synonym is a quick, simple wrapper for a word.
drove - verb (function) pertaining to Mikey (of type car).


MongoDB Logo MongoDB