Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.etla.org!aioe.org!.POSTED!not-for-mail From: "Rod Pemberton" Newsgroups: comp.lang.forth Subject: Re: Creating a lisp compiler Date: Tue, 08 Apr 2014 06:04:42 -0400 Organization: Aioe.org NNTP Server Lines: 42 Message-ID: References: <35a650bd-b706-495e-b4a0-b1c15797d474@googlegroups.com> NNTP-Posting-Host: CNsg4fVcCsvs3UaOgZtQCw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.16 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.forth:29431 On Tue, 08 Apr 2014 03:16:38 -0400, Hi-tech Robert wrote: > Hi, I am planning an OS for a Google glass-like hobby project I > am working on. ... > I am hoping to use Forth to create an assembler for lisp and > Haskell. Generally, assemblers are coded in assembly, or they're coded in the language they're for, i.e., in lisp for lisp. You're asking how to produce a cross assembler. Thoae are far less common. In Forth terminology, a cross compiler is called a meta-compiler. So, I'm assuming a cross assembler is called a meta-assembler. > I am new to this language so please forgive my ignorance, any > advice how? Assemblers can be complicated, or not. It depends heavily on the assembly language for the specific microprocessor in question. E.g., the x86 instruction set has some complicated encodings. The rudimentary concepts are you parse syntax which tells you which instruction to assemble and how the instruction format for that specific instruction is to be filled in. The information that needs to be filled in can be a variety of things, such as offsets, bits to select a register or memory location, etc. This requires a bunch of bit fiddling, with AND OR XOR etc. The microprocessor instruction manual for the microprocessor in question should show you the format for each instruction. Generally, Forth programmers concoct their own syntax for a specific assembly language, whereas other coders will use the syntax provided by the microprocessor instruction manual. This is because Forth's have a limited but functional parser built into the language. As for using the Forth language to do this, others here will have to help you. Rod Pemberton