diff options
author | matthewsotoudeh <matthewsot@outlook.com> | 2017-01-16 17:31:45 -0800 |
---|---|---|
committer | matthewsotoudeh <matthewsot@outlook.com> | 2017-01-16 17:31:45 -0800 |
commit | eff1cb3ef03477479479024f253ce3132fe7a717 (patch) | |
tree | 1394c1f903063a5328c970e03ac55f783d68673f | |
parent | 48ad2294f61a0fafd423951713ea8719a54912e7 (diff) |
-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_ +- |