Category Archives: programming

VSV Official Site

VSV (Versatile Separate Values) now has an official site at . There you can read:

  • description and benefits of VSV
  • instructions on writing and reading VSV files
  • examples of various VSV code and outputs
  • lists, tables, playlist, subtitles, site summary, object notation, markup language
  • editor to test VSV / VML and view the results
  • download libraries of VSV implementation in various programming languages, including Lua, PHP, Javascript

!!AB : Creating Compile Language : Part 1


Per the original spec for my Nonalphabetic Programming Language --dubbedd !!AB or NOTAB-- I have finally gotten around to trying to turn it into an actual usable product. First time around, I haven't gotten used to Flex/Bison yet, so I didn't get anywhere. But this time, I think I have a slightly better grasp, and have something that seems to work. I've read some tutorials, but still have a long way to fully understand the syntax and logical procedure and grand vision for Flex/Bison.

It's still at a very early stage. The source code can be found at this git repository for NOTAB.


First area I started with is text output, so that I can see the results of the sample source code written in !!AB language. It will only accept double-quotes and not single-quotes/apostrophe to enclose strings--in order to not use up the limited number of nonalphanumeric characters, nor to use symbols in combinations that are not intuitive. (Like why do languages have comments and comment blocks delimited by // and /*? This makes no sense.) Per the specs of this new language, the early draft of my Flex code went something like this:

\"                { BEGIN(MODE_STRING); }
<MODE_STRING>[^\"]*  { yylval.sval = strdup(yytext); return STRING; }

The program always begins in the INITIAL mode.
tells Flex this is a mode that the program will enter and leave when it encounters specific text in the source. In this case, this mode will try to capture a string of text between two double-quotes "". This is an exclusive mode --signified by %x-- which means only rules beginning with this code --
-- will be processed while the lexer is under this mode. (The other type is inclusive mode, signified by %s.)

When it sees a double-quote while not in MODE_STRING mode, it will turn on this mode. While in this mode, any character besides the double-quote is considered part of the string, including newlines. That means a string can span multiple lines.

This mode will end when it meets the next double-quote. Caveat is that the !!AB spec desires that double-quotes within strings be escaped as \". However, this is not possible yet, since my skill with Flex/Bison is still very lacking. Although one idea is to create a temporary string variable when it first enters this mode. Then create a new rule to additionally capture \". Finally when it leaves this mode (but not before), the entire string will be returned.


Also completed the comment system. Much simpler than strings concept. Allows both single- and multi-line comments. Single line comment begins with single-quote ', and will ignore the rest of the line. Multi-line comment blocks are enclosed within '[ and '].

Flex goes like this:

"'["		       { BEGIN(MODE_COMMENT); }
	[^'\n]*      // ignore anything that's not a '
	'+[^'\]\n]*  // ignore ' not followed by ]
	\n           { ++line_num; }
	'+"]"        { BEGIN(INITIAL); }

'[^\[][^\n]*		; // comment, ignore rest of line

I designate a second mode for block comments. It initiates when it detects '[. It ignores pretty much every character while in this mode. The new line is to keep the line number for debugging, so you know the line number of the input source when you get an error.

There are two different checks during this mode. The comment mode exits when it meets ']. So you can have series of ' with or without a trailing ]. Therefore check both conditions to get the desired behaviour.

Also to ensure single line comments don't interfere with multi-line, it must check against the opening bracket [ that starts multi-line mode.

Test Source

Here is the test source file written to the specs of the new language. It seems to work as expected.

$< "Hello Master " + "Xayvir."

$< "What about
$< "Or \n escaped newlines?"

$< "!!AB is such a \"great\" programming language" ' aka NOTAB

$< 890 + \
" beers on the wall."

$< "I have " + 11.01 + " dollars." 'US dollars

comment block

$< "Flavor text with" + '[ this should not appear '] " inside comment block"

$< "What about unclosed string?"

While writing this post but before completing, I went ahead and read more materials on getting Flex to do more complicated strings and comments. So the strings section in final program is actually more advanced than what is posted in this post. (You can read that site rather than me repeat them here.)

TablesPlus plugin

TablesPlus plugin for WordPress

TablesPlus allows alternative, efficient ways to create tables and lists.



[ tables=vsv]
((``Keyboard Layouts``tc))
((Name)) ((Score 1)) ((Score 2))
,BEAKL 8, 104, 132
,BEAKL 9, 120, 144
,BEAKL 10, 44, 99
Keyboard Layouts
Name Score 1 Score 2
BEAKL 8 104 132
BEAKL 9 120 144
BEAKL 10 44 99

[ tables=vsv]
[[Name]] {{Age}} ((Gender))
,Hammie, 20.5, F
-Chow, Vivian-40-F
*Shena'Fu *18+5/12 *F
|Grndr-1245|21 months||
((``Guess who they are? :)``bl))
IdolsGuess who they are? :)
Name Age Gender
Hammie 20.5 F
Chow, Vivian 40 F
Amuseum 25 M
Shena'Fu 18+5/12 F
Grndr-1245 21 months

Continue reading TablesPlus plugin

Layers of Computing

A theory that crossed my mind when pondering the relationship between functions and threads.

Layers of Computing
1: memory, storage
2: address
3: data, pointer, array, class (Turing)
4: instruction, operation, expression(2GL)
5: function, loop, routine (3GL)
6: thread, process (4GL)
7: algorithm, solution, library(5GL)
8: application, product
9: operating system, language, I/O
10: computer, brain
11: intelligence
12: universe

Nonalphabetic Programming Language

Nonalphabetic programming language
called !!AB

Programming language where common and simple operations and expressions (excluding variables) are typed with non-alphabetic symbols. Allows various programming paradigms, including procedural, object oriented, and functional.  Balanced ternary is the base for logic and digit operations. Decimal numbers are preferred for human readability. Array index starts at 1.

 Continue reading Nonalphabetic Programming Language 

PLURPS: Programming Language Using Role-Playing Syntax

PLURPS - Programming Language Using Role-Playing Syntax

Just an idea to write code as if we are playing a RPG. Very initial brainstorm.

Class - class
New instance - create
Delete instance - kill
If - attack
Then - hit
Else - miss
Function - skill
Parameters - targets
Return - result
Switch - menu
Case - option
Array - group
Add to array - join
Delete from array - leave
For - fight <stat> <value |number>
Next in loop - grind
Increment - up (<stat> up <optional number|default 1>)
Decrement - down (<stat> down <optional number|default 1>)
Break - flee
Continue - skip
Variable - stat
Integer - number
String - quote
Local - melee
Global - ranged
End block - done
True - yes
False - no
Output - say

The following examples may or may not be valid. Only to show what it could or should look like.

Example 1:
say "Hello World"

Example 2:

fight level 0
grind level < enemies.size
   attack goblin > 25
   attack player.hp <= 0
   level up

MTG Utilities: Mana

The code for inserting mana symbols is [ mana]cost[/mana]. Put the entire cost inside. Hybrid halves and Phyrexian mana should be separated by a slash '/', in any order. Use '2' for monocolor hybrid and 'p' for Phyrexian. Tribrid and hybrid-phyrexian use three letters divided by two slashes; the letters can be put in any order. Put a semicolon between the numbers if there are two consecutively, but want them to show up separately.

These are the valid letters, numbers, and hybrids and tribrids that can be used within the mana tags:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
b c e g h i p q r s t u w x y z
w/u u/w u/b b/u b/r r/b r/g g/r w/b b/w u/r r/u b/g g/b r/w w/r g/u u/g
2/w w/2 2/u u/2 2/b b/2 2/r r/2 2/g g/2
p/w w/p p/u u/p p/b b/p p/r r/p p/g g/p
p/w/u p/w/b p/u/b p/u/r p/b/r p/b/g p/r/g p/r/w p/g/w p/g/u
b/u/w r/b/w r/b/u g/r/u g/r/b w/g/b w/g/r u/w/r u/w/g b/u/g

and their corresponding symbols:

Continue reading MTG Utilities: Mana