Hi Kashyap,

> I feel pretty sure that I should be able to translate the .s into nasm
> syntax fairly mechanically. I have done similar things before. What I love
> about nasm is that there is no ceremony code :)

I see. Nice!


> @Alex - I have a follow up question about POSIX requirement - To bet the
> basic REPL up and running the POSIX requirement would be limited to getc
> from STDIN right?

Yes, plus print to stdout. You have to remove a lot of stuff though.

The REPL is now 'doLoad' -> 'loadBEX_E', which also open a file if input is not
from the TTY, and then calls 'readC_E' to read an expression, which in turn
trickles down via (Get_A) indirection to 'getStdin_A' (which you may call "getc"
but which involves the whole event machinery using the select() system call in
'waitFdCEX_A').

You can compare the full version vs. a plain getc() version if you look at
the differences between src/io.c and miniPicoLisp/src/io.c - in the latter
we have

   void getStdin(void) {Chr = getc(InFile);}

as opposed to the full version in pil32 (which does the same as 'getStdin_A' in
pil64)

   void getStdin(void) {
      if (!InFile)
         Chr = -1;
      else if (InFile != InFiles[STDIN_FILENO]) {
         if (InFile->ix == InFile->cnt  && (InFile->ix < 0 || 
!slow(InFile,NO))) {
            Chr = -1;
            return;
         }
         if ((Chr = InFile->buf[InFile->ix++]) == '\n')
            ++InFile->line;
      }
      else if (!isCell(val(Led))) {
         waitFd(NULL, STDIN_FILENO, -1);
         Chr = stdinByte();
      }
      else {
         static word dig;

         if (!isNum(Line))
            dig = isNum(Line = name(run(val(Led))))? unDig(Line) : '\n';
         else if ((dig >>= 8) == 0)
            dig = isNum(Line = cdr(numCell(Line)))? unDig(Line) : '\n';
         Chr = dig & 0xFF;
      }
   }

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to