newbie: making a BASIC comiler

"Gernot" <Gernot.Frisch@Dream-D-Sign.de>
6 Feb 2003 00:14:25 -0500

          From comp.compilers

Related articles
newbie: making a BASIC comiler Gernot.Frisch@Dream-D-Sign.de (Gernot) (2003-02-06)
Re: newbie: making a BASIC comiler robert.dimond@ic.ac.uk (Robert Dimond) (2003-02-12)
Re: newbie: making a BASIC comiler ramesuec@yahoo.co.in (2003-02-21)
| List of all articles for this month |
From: "Gernot" <Gernot.Frisch@Dream-D-Sign.de>
Newsgroups: comp.compilers
Date: 6 Feb 2003 00:14:25 -0500
Organization: Compilers Central
Keywords: design, question, Basic
Posted-Date: 06 Feb 2003 00:14:25 EST

G'day,


I did a BASIC compiler on my own, but now, that files are getting
bigger&bigger, it's too slow. (I used lot's of string replacements - pretty
crappy, huh!?)
I want to make a new version using LEX/YACC (at least I think I want to).


- Can I do this with LEX/YACC, or what is best to use?
- Can the BASIC contain user defined functions?
- What about local variables?
    // Sample of what should work
    FUNCTION name: arg1, arg2$
        LOCAL temp
        temp=arg1 * arg2$ // See: arg2$ is cased to number!
        retval=temp
    ENDFUNCTION retval
    PRINT name(5, "7") // See: function with and w/o braces!


- And process include files or multiple file input?


- Can I define structures? That would be cool, but neccessary.
    STRUCT Car
        brand$
        color
    ENDSTRUCT
    DIM veh AS Car
    veh.brand$ = "Fauxpas"
    veh.color = RGB(255,0,0)


- On the other hand, I wish to have name and name$ automatically
    as global numbers and strings defined.


- Has anybody some experience with BASIC and can give me
    some tips to avoid mistakes in the beginning?
- Will the produced code be fast? My compiled code was
    (in contrary to the compiler) fast as heck. Will it be?
- Will YACC create C-code or ASM?
- What is a BNF?
- Can I compile YACC with Visual Studio or only with GCC?
- When inserting new commands: Do I have to recompile the
    compiler, or can it read a file?


I'm sorry for the stupid beginners questions, and appreciate any help.


Thank you
Gernot Frisch.


__________________________
DREAM DESIGN ENTERTAINMENT
DiNGS Game Basic/ClipMagic
http://www.Dream-D-Sign.de


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.