guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BASIC->Guile Converter v0.6


From: Richard Todd
Subject: Re: BASIC->Guile Converter v0.6
Date: Fri, 5 Dec 2003 17:51:32 -0600
User-agent: Mutt/1.5.4i

Thanks for your interast!


On Fri, Dec 05, 2003 at 01:23:07AM +0000, Neil Jerram wrote:
> 
> I have two questions.
> 
> - There are many BASICs; does your translator try to emulate one spec
>   in particular?  If so, can you give me the reference for that spec?

These are my goals when language decisions come up.  

I'm mainly wanting to do:
  1) What is cleanest, code-wise.
     (supports guilesic as a learning tool)

  2) What mixes with guile best, especially for use in customizing
     other programs.
     (supports guilesic as a useful tool)

  3) What would hopefully surprise BASIC programmers the least,
     given that (1) and (2) keep me from replicating any one
     BASIC from the past
     (supports general acceptance of guilesic)

For the keywords/syntax, I'm going on my memories of GWBasic from way
back when, minus the line numbers.  I've used some knowledge of VBA
for Excel, since I've had to do some as part of my job.  I want this
to look like a BASIC to someone who knows a dialect, but I never
intended it to be a (for example) visual basic clone, though.

I am open to input if anyone thinks this is the wrong direction to go.


> - Does your translator support BASIC programs split across multiple
>   files?  

I'm not sure what you mean, exactly, so I might be answering the wrong
question here.  I'll try a couple ways:

1) If you are asking for a `LOAD "filetwo.bas"' command that you can
put in the middle of another .bas file, then I don't think that's much
of a hassle to implement...the lexer would just need to replace that
line with all the tokens from filetwo.bas.  The parser won't know the
difference.


2) If you have several BASIC files defining functions, just load them
up from scheme in a sensible order:

(for-each eval-basic-file '("one.bas", "two.bas", "three.bas"))

Or, if "two.bas" has some immediate code that calls a function in
"three.bas," then you could always slurp the files to a single string,
and run:

(eval-basic-string str)

on them. This will simulate one big file being read, and the
basic->scheme translator puts all the function definitions at the top
of the scheme output.

3) For modular programs, I plan to support modules that can be called
from BASIC or scheme.  I'd like to eventually figure out how to define
a BASIC module in a 'natural' way, which would require guile hooks, I
think.  Right now, I define BASIC modules via a scheme wrapper like
this:

(define-module (util conversions)
  #:export (Celcius2Fahrenheit)
  #:use-module (lang basic))

;; fixme -- make this find the file in a search path...
(eval-basic-file "/abs/path/to/conversions.bas")


Richard

Attachment: pgp3kR0v0kjiD.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]