Nikki1
nikki1 is a program that, like nikki0, reads HEX numbers & strings, and writes them
to stdout.
An input like this:
48 65 6C 6C 6F " world"
nikki1 turns it into:
Hello world
Nikki1 also supports:
- Line comments starting with a semicolon
48 65 6C 6C 6F ; this is a comment
Improvements over nikki0
nikki1has a proper lexer, parser & emitter, whereasnikki0just reads & prints bytes.nikki1recognizes HEX as:[0-9A-F], not lowercasea-f, this is because future iterations will feature identifier & LISP-like syntax.nikki1receives its input file via argv, so the input is no longer hardcoded.
Usage
Example input
;; prelude
"nara" ; magic
00 00 ; MAJOR
00 02 ; minor
00 00 00 00 ; module name constant index
;; ==================================================
;; Value section
;; ==================================================
00 00 00 00 ; value count
;; ==================================================
;; Blob section
;; ==================================================
00 00 00 75 ; blob len
"nikki1::lex" ; @0-11, len=11
"from_string" ; @11-22, len=11
; --------------------------------------------------
; nikki1::lex::ignore_comnent
; --------------------------------------------------
00 00 00 12
00 00 00 3B
08 2A ; :
06 0A ; :
06 0B ; :
; :
05 2A 31 ; :
04 0A 11 ; :
04 0B 12 ; :
; :
10 00 0A 0B ; :
24 00 00 1A ; :
05 31 2A ; :
04 11 0A ; :
20 00 09 ; :
3C 0A 0A 00 01 ; :
0B 00 11 00 0A ; :
25 00 00 03 ; : ~exit
22 FF DE ; : ~loop
; :
04 11 0A ; :
07 0B ; :
07 0A ; :
09 2A ; :
00 ; :
;
FF FF FF