Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #29431

Re: Creating a lisp compiler

From "Rod Pemberton" <dont_use_email@xnothavet.cqm>
Newsgroups comp.lang.forth
Subject Re: Creating a lisp compiler
Date 2014-04-08 06:04 -0400
Organization Aioe.org NNTP Server
Message-ID <op.xdzsx4lb6zenlw@localhost> (permalink)
References <35a650bd-b706-495e-b4a0-b1c15797d474@googlegroups.com>

Show all headers | View raw


On Tue, 08 Apr 2014 03:16:38 -0400, Hi-tech Robert  
<hitechrobert@gmail.com> 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

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Creating a lisp compiler Hi-tech Robert <hitechrobert@gmail.com> - 2014-04-08 00:16 -0700
  Re: Creating a lisp compiler Paul Rubin <no.email@nospam.invalid> - 2014-04-08 00:41 -0700
  Re: Creating a lisp compiler "Elizabeth D. Rather" <erather@forth.com> - 2014-04-07 22:20 -1000
  Re: Creating a lisp compiler "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-04-08 06:04 -0400
  Re: Creating a lisp compiler Mark Wills <markwills1970@gmail.com> - 2014-04-08 03:32 -0700
  Re: Creating a lisp compiler hughaguilar96@yahoo.com - 2014-04-13 00:04 -0700
  Re: Creating a lisp compiler Hi-tech Robert <hitechrobert@gmail.com> - 2014-04-15 02:12 -0700
    Re: Creating a lisp compiler "Alex McDonald" <blog@rivadpm.com> - 2014-04-16 11:46 +0100

csiph-web