Thanks Alex, I'll explore the lib/asm.l approach for now. A cursory look at llvm.l tells me that it will take me a *little* bit longer to digest it :) Regards, Kashyap
On Wed, Feb 19, 2020 at 12:59 PM Alexander Burger <a...@software-lab.de> wrote: > Hi Kashyap, > > > What would you recommend if I had to write an assembler for RISC V? Can I > > look at llvm.l in pil21 or should I look at lib/asm.l in pil64? > > I would say that lib/asm.l is the way to go. It maps directly to a target > assembly language (or C in case of 'emu'). > > llvm is a different, special machinery. > > > > I mean, I could always write a program that takes the assembly as a text > > file input and parses it - but where's the fun in that? ... I mean, I > > really liked the idea that lib/asm.l uses the reader to read the symbols. > > Right. > > On the other hand, llvm.l goes even a step further. It not only uses the > reader, > but the whole interpreter, and simply *redefines* all needed functions > (like > 'de', 'let', 'if', 'cond', 'while', 'car', 'cdr' and many many more) in a > 'llvm' > namespace, so that they compile LLVM-IR code instead of executing > something. This > is well in the tradition of Forth compilers. > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >