A BASIC Compiler written in JustBasic

Applications written for Just BASIC in languages other than Just BASIC
NTech
Posts: 23
Joined: Mon May 01, 2017 7:29 pm
Location: USA

A BASIC Compiler written in JustBasic

Post by NTech » Tue Nov 27, 2018 10:24 pm

Please note that this is not official, nor is it associated in any way with JustBasic, insofar as it is written in it.

This is where I will put the Basic Compiler when it's completed - next week v1.0 will be released.

The compiler:

-Makes a fully functioning PE executable (.exe)
-Will support ALL of JB commands.
-Will integrate JustBasic into the .NET family - Use namespaces, reference assemblies, and more!

Progress:

-Currently, support for the print statement and variables are being initialized.

Notes:

-All variables will have to be declared like this:

Code: Select all

'#define myVariable string
or

Code: Select all

'#define myVariable number
-All new commands will be commented out, that way programs will run in JustBasic as well as compile.
-The compiler is written in JustBasic, but uses ilasm.exe, which is a component of the .NET framework, which is why it is listed as a advanced utility. :!: :!: [*]
Last edited by NTech on Mon Dec 10, 2018 9:42 pm, edited 2 times in total.
8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8)

NTech
Posts: 23
Joined: Mon May 01, 2017 7:29 pm
Location: USA

Re: BASIC Compiler

Post by NTech » Wed Nov 28, 2018 4:49 pm

Update: An unexpected difficulty has postponed the completion of the PRINT and variable declarations to next week. Due to variable scope, an additional parser will need to be implemented to take care of variable initiation, as well as a subroutine/function/label parser to handle definitions of scope.

But by the end of next week, it should be ready with the following commands:

-PRINT
-Variable declaration and usage.
-SUB, END SUB
-FUNCTION, END FUNCTION
-[Labels]

And V1.0 will be ready for use.
Last edited by NTech on Mon Dec 10, 2018 9:36 pm, edited 1 time in total.
8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8)

NTech
Posts: 23
Joined: Mon May 01, 2017 7:29 pm
Location: USA

Re: BASIC Compiler

Post by NTech » Mon Dec 03, 2018 8:46 pm

Version 1.0 Alpha Release

Questions:
:?: Does JB2IL require any external components?
:arrow: No, only JustBasic and ilasm.exe which is supplied with every Windows OS in one of these locations:
  • C:\Windows\Microsoft.NET\Framework\v2.0.50727\ilasm.exe
  • C:\Windows\Microsoft.NET\Framework\v4.0.30319\ilasm.exe


Notes:
  • :idea: Supported Commands:
    PRINT (With Variables) (Note - no operations such as num + num2) (Note - no functions such as str$())
  • :idea: Notes:
    Variable Declaration - ALL variables must be declared prior to their use like this:

    Code: Select all

    '#define myVariable$
    
    OR

    Code: Select all

    '#define myVariable
    
    Note that they are to be commented out, thatway they don't generate errors.
  • :idea: Compiler Status:
    Note that this does NOT of yet generate a PE executable (.exe). Currently, until it will support more features, it will remain a translator. If you're interested, you may view notes.txt to see more notes, view example.bas to see what it supports, and view tmp.il (this is generated by a successful compile) to see what IL code looks like.
You do not have the required permissions to view the files attached to this post.
Last edited by NTech on Mon Dec 10, 2018 9:37 pm, edited 2 times in total.
8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8)

NTech
Posts: 23
Joined: Mon May 01, 2017 7:29 pm
Location: USA

Re: BASIC Compiler

Post by NTech » Mon Dec 03, 2018 9:02 pm

For those interested, here's a full list of IL commands.
Last edited by NTech on Mon Dec 10, 2018 9:37 pm, edited 1 time in total.
8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8)

NTech
Posts: 23
Joined: Mon May 01, 2017 7:29 pm
Location: USA

Re: BASIC Compiler

Post by NTech » Fri Dec 07, 2018 1:12 am

JB Compiler v0.2

New commands: INPUT, GOTO, [LABEL]

Notes: Input can only put info into a STRING variable as of now.

IT NOW COMPILES INTO A .EXE -- WHEN YOU'RE DONE COMPILING, RUN 'TMP.EXE' TO SEE FOR YOURSELF.

Bugfixes: '#define FIXED.
You do not have the required permissions to view the files attached to this post.
8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8)