diff options
-rw-r--r-- | asm-yaepl/.README.md.swp | bin | 0 -> 12288 bytes | |||
-rw-r--r-- | asm-yaepl/README.md | 34 |
2 files changed, 34 insertions, 0 deletions
diff --git a/asm-yaepl/.README.md.swp b/asm-yaepl/.README.md.swp Binary files differnew file mode 100644 index 0000000..f27542a --- /dev/null +++ b/asm-yaepl/.README.md.swp diff --git a/asm-yaepl/README.md b/asm-yaepl/README.md new file mode 100644 index 0000000..1140c2a --- /dev/null +++ b/asm-yaepl/README.md @@ -0,0 +1,34 @@ +# ASM-Yaepl +Mimics simple assembler syntax. + +- Non-OO (would translate well to simple Javascript/C) +- Modified AT&T style: ``operation source -> destination`` +- Simple syntax, but still as 'cozy' as Javascript with strings, functions, etc. +- Can start with jumps/etc. for things like loops, then build up to a C-like syntax for them + +# Hello, World! +``` +write-line "Hello, World!" -> console //Write "Hello, World!" to the console +str-len "Hello, World!" -> $len //Store the length of "Hello, World!" as $len +int-to-str $len -> $len //Convert $len to a string before writing it +write-line $len -> console //Write $len to the console +``` + +# Functions +Functions could be implemented in a number of ways. Consider ``str-len`` from above: + +``` +@str-len $str: + move 0 $len + + #loop + move ($str[$len] != "\0") $continue + move (1 + $len) $len + jump-if $continue #loop + + return ($len - 1) +``` + +# Pros +- Syntax is extremely simple, can focus 100% on teaching the _concepts_, not the _syntax_ +- |