"Micro" - Views: 72 · Hits: 72 - Type: Public

Micro Version 2 |
By Burke Johnson

note: all stack examples in this document
will referance positions as letters

bottom of stack (letters that are alphabetically
first) [a b c d e] top of stack (letters that are alphabetically last)

so, e would be the most recently pushed element in this case

functions that are longer than one character
are enclosed by #function_name#

----variables, operations, and types

;	Begins and ends comments

{a}	Push a code block with the content 'a'

'a'	Push a string containing 'a'

[1 2 3]	Push an array this the contents 1,2,3
	(Note that [[1 2] [3 4]] will create
	An arry containing an array
	(think of it as a 2-dimensional
	array). Address it with varname

(a)	Push the symbol a to the stack

:	Pop A,B
	if the stack was [A B], this sets B to
	referance A. To store 5 to variable A,
	execute: 5(A):
	if symbol B is (stdout), this
	will write to the output file.
	(how this output is handled is
	dependant on the implementation)
	You may set a symbol to referance
	another symbol. Note that if you set
	symbol A to referance symbol B,
	changing A does not change what B
	refers to, but changing B's referance
	changes what A's referance. In
	an interpreter, consider a symbol
	table that records what symbols
	refer/point to. If symbol A is set to
	refer to symbol B, A's entry on the
	table will look something like:

	symbol.table[symbol.getid("A")] =

	If you set A to point to five, it will

	symbol.table[symbol.getid("A")] =

	This will have no effect on B.
	This example does illistrate how
	changing B changes A.
	An interesting use of this would be to
	point to specific indexes on arrays.
	An array index's symbol will look like


	Though this may seem to operate like


	at first, these do very different
	things internally.
	Doing (a[i])(b): will set b to point
	to a[i], essentially giving a[i] a
	name, rather than an address.

	Doing a[i](b): will set b to point at
	a[i]'s CURRENT value, and b will not

	Here is a list of system symbols:

	name:	operations:
	stdout	R/W
	stdin	R/W
	stdins	R/W

	stdins stands for 'stdin state'
	When pointing to a 1, stdin is updated
	When pointing to a 0, stdin is not
	stdin points to last character typed.
	A symbol may also point to a path.
	Paths point to the actual storage
	address of the referanced content.
	Paths are defined like ?a? where a
	is the data's address. ?a? should be
	an 8 digit hexadecimal number in a
	65535 bit system, because four hex
	digits can cover all of the memory.
	The first four would cover the start
	of the referanced memory range, and
	the last would cover the end of the
	memory range. Note that these ranges
	are inclusive. In different systems,
	word size is stored in sysword
	memory size is stored in sysmem
	This is useful where you want to
	modify data at a specific address.
	However, since writing code like
	can get tedious, you can name
	addresses like this:
	to make referance easier.
	The address range can be treated as a
	giant int, or an int array, with each
	index being the length of (sysword)

bind	When the stack is [A] where a is a
	symbol, bind will bind (A) to its
	referance, so writing to (A) writes to
	its referance.

unbind	When the stack is [A] where a is a 
	symbol, unbind will unbind a bound
	symbol (A) from its referance so it
	may be written to normally once again.

{a}	pushes a code block that contains 'a'
	when evaluated, the code is executed.
	if the code is referanced by a symbol,
	pushing the symbol and popping it will
	evaluate the code.

.	pop the top element of the stack. the
	element may be referanced by the
	symbol (register). if any code block
	is popped to the register, it is
	evaluated immediately.

+	pop A,B and push A+B

-	pop A,B and push A-B

/	pop A,B and push A/B rounded down

\	pop A,B and push modulo A,B

*	pop A,B and push A*B

ri	'retrieve index' take a stack with
	A being a string or array and B being
	a one dimensional array.
	B is immediately popped.
	If A is a string, B[1] is the
	inclusive starting index, and B[2]
	is the inclusive ending index.
	The range of values is pushed as a
	If A is an array, then length of B is
	equal to the number of dimensions of A
	if B is [4 2 8] then A[4][2][8] is

rd	'retrieve dimensions' lists the max
	number of dimensions in an array
	without popping it
	(max number of nexted lists plus 1)
	[1] rd returns 1
	[1 [2 3]] returns 2
	[1 [[2] 3] [[4] 5 6] 7 8 9] returns 3

rt	'retrieve type' pushes the type of the
	element at the top of the stack
	return number, and meaning:
	1 - symbol
	2 - int
	3 - string
	4 - array
	5 - code block
	(note that symbols will always return
	1, no matter their referance)

rl	'retrieve length' push the length of the
	string or block or array on top

eval	evaluate a symbol at the top of	the
	stack. this pushes the referanced
	content of the symbol without
	popping the symbol.

stop	force the end of code execution

=,<,>	pop A and B. if A [comparison] B is
	true push 1, else push 0

!	pop A, push Not(A)
&	pop A,B	push And(A,B)
|	pop A,B	push Or(A,B)

~	swap top 2 elements. (pop A,B
	push B,A)

"	(double quote) pop A, push A twice

_	Push (register) equivalent to

neg	Pop A push -A

rp	'retrieve path' retrieve the address
	of the symbol on the top of the stack.

wipe	pop entire stack

,	input and push a number

`	input and push a string

nstr	push the string equivalent of the int
	on top of the stack

nchar	push the ascii characters for the int
	index(s) on top of the stack
	( 28 -> 'FS' 86 -> 'v' [72 105 33] ->

snum	push the number equivalent of the
	string on top of the stack

sint	push the ascii code(s) for the string
	on top of the stack
	('!' -> 33 'Hi!' -> [72 105 33])

bstr	push a string containing the contents
	of the block previously on top of the
	({2 3+#nstr#} -> '2 3+#nstr#')

sblock	push a block containing the contents
	of the string previously on top of the

strsym	push a symbol whose name is the
	contents of the string previously on
	top of the stack.

symstr	push a string containing the name
	of the symbol previously on top of the

F	if the integer on top of the stack
	is greater than 0, run the code
	referanced by (t)
	if the integer is 0, run the code
	referanced by (f)

go	Pop A, jump to the label named A in the program

come	Pop A, create a label with name A here

lset	pop A,B set array/string B to length A

push	pop A,B push A onto end of array/string B

pop	pop A,B push end of array/string B onto stack
	and remove it from the array/string

lins	pop A,B,C insert A before index B in
	array/string C

lrem	pop A,B remove index A from array/string B

lrepl	pop A,B,C replace value of index B of C with A

(null)	A built in symbol describing symbols without a
	pointed to referance

note: if a write operation attempts to edit the symbol's referanced data, a bound symbol must be used.