Home | Reviews | GUIpedia | Forum | Fun500
ksr | languageJust some more information about the language I'm developing (some initial thoughts here: http://file-pasta.com/file/0/intro.pdf) All variables (and stack elements) are stored in FreeBASIC as strings. The first byte determines the type of the variable: A binary 1 indicates a real type. The binary value of the 2nd byte then gives the length of the following string which represents the real number. For example, the real 123.45 is stored as: 16123.45 (where the underline denotes binary values) A binary 2 indicates a complex type, basically just two reals. Example: 10 + 5j is stored as 221015. A binary 3 indicates a vector type. The 2nd byte indicates the number of elements in the vector. Each element can be of any type. Example: the vector of 3 reals (2 4 6) is stored as 33[112][114][116]. I've split the elements for clarity, but in the string they are just stored sequentially. There's no need to delimit them as they all contain information about their length. A binary 4 indicates a matrix type. Really just a vector type with an additional length byte. Example: The 2x2 matrix [1 2|3 4] is stored as 422111112113114. A binary 5 indicates a string type. Much the same as a real. Example: "Hello, World!" is stored as 5[13]Hello, World!. Remember the length is stored in binary - it occupies a single byte. I've just split it here for clarity. Hopefully this demonstrates how you can easily nest different variable types. Also: the language needs a name! | 2010-03-21 | 5:07 PM |
ksr | Re:languageThe interpreter is progressing well. There is so much recursion required to apply functions to the infinitely-nestable data types it's doing my head in. If you want an idea of what the language is like, you should watch this quite incredible video, showing Conway's Game of Life implemented in a single line of APL: http://www.youtube.com/watch?v=a9xAKttWgP4 My language (still unnamed!) is similar to APL except it's stack based and doesn't have silly characters. I'll post what the Game of Life would look like in it shortly. | 2010-03-29 | 11:19 AM |
2021 Brandon Cornell