This language is:
* Stack-based.
* Monotypical.
* Reflective.
* Structured.
Here is the expected hello world program:
"Hello world in qsil" ; "Hello, World!\n" #greeting := ; greeting :print ;This demonstrates several important features of the language. The source code is divided into tokens, (delimited by whitespace, except within quotes and brackets) each of which is then put into a queue of strings. The tokens are then evaluated for their effects, which depend on their format. Tokens in a quote delimited string format push the corresponding string onto the stack. Tokens which are symbol literals "#greeting" push their name "greeting" onto the stack. Tokens which are numbers "123.456" push the number in decimal onto the stack. However, tokens which are symbols without the # get looked up in the symbol table, and then the value that variable contains is pushed. Any tokens that do not match any of the above criteria are assumed to be built in operators.
So, let's go through that code again. The first line has a string literal, and then the operator ";". That operator discards everything on the stack. Therefore the line does nothing, since it does not alter any variables or perform any I/O. The second line contains a string literal, a symbol literal, the operator ":=", and the operator ";". First, the string literal is evaluated to a string, and pushed onto the stack. Next, the symbol literal is evaluated to the string "greeting", and pushed. Next, the ":=" operator assigns the string "Hello, World!\n" to the symbol "greeting", popping each off the stack. Finally, the ";" operator clears the stack, though it is already empty. In the last line, the "greeting" symbol is evaluated for the string "Hello, World!\n", and then the :print operator pops it off the stack and prints it.
YOu should now have a fairly good idea of how this language operates. However, there is one more intricacy to the language: code constants. In qsil, code itself can be data. This enables functional programming, and is the basis for conditionals and loops. Take a look at the following example:
"Invisigirl" "violet" := ; "Elastigirl" "helen" := ; "Mr. Incredible" "bob" := ; "Dash" "dashiel" := ; ( "Name:" :print :gets #nam := "Supername:" :print :gets #sup := nam :deref pwd = ) #chksupname $=The new function chksupname checks the identities of the members of the Parr family (The Incredibles) by asking them their superhero names. It returns 1 if the entered name and supername match, 0 if not. The operator $= assigns the code to a variable, but with execution on. When the name of the function is used, the code is not pushed onto the stack, but executed.
:More details later, after I've heard suggestions and stuff.
This description is public domain. Whatever.


Sign In
Create Account


Back to top









