Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    BASIC Interpreter

    Work In Progress
    3
    11
    567
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      EvanTropFun last edited by

      Hey, i like your project ! ( : It's a very good idea ! eagerly that you finish it !
      but won't the variable system be too difficult to implement?

      L 1 Reply Last reply Reply Quote 1
      • L
        LucasJG25 @EvanTropFun last edited by

        @EvanTropFun the variable system isn't too difficult. I have already got strings in place. Just need to check expressions such as if a string is added to a string

        1 Reply Last reply Reply Quote 1
        • L
          LucasJG25 last edited by

          Improved the Terminal so now it can deal with accurate colors when changing them. Still need to add FOR and WHILE loops to the interpreter but for now the IF statement has been added.
          https://twitter.com/Lucas1904875369/status/1380299468583493634?s=20

          1 Reply Last reply Reply Quote 2
          • L
            LucasJG25 last edited by

            OK Type checking is down (Sort of). I need to do a lot of tests.

            1 Reply Last reply Reply Quote 1
            • L
              LucasJG25 last edited by

              I've split my project into 2 different directions. 1) Keeping it as an interpreter. 2) Turning it into a compiler and translating the code line by line into an IR. Where the entire code will be translated into bytecode and run on a VM.

              1 Reply Last reply Reply Quote 1
              • L
                LucasJG25 last edited by LucasJG25

                @NextWithoutFor Special characters can be used in the Terminal as this is mainly adding functionality to the Terminal.

                However, Fuze's Fonts are limited and thus a lot of the ascii characters are not all available. Which means one would need to create their own fonts.

                So what I can do is split the project into two.
                One project will only have text and the other will incorporate graphics into it.

                The text version will be released first then the graphics version. (Though this would requre a lot more functionality but can be done).

                Also, I wanted to point out that the version of BASIC I'm interpreting is the GW-BASIC version. This is a slightly upgraded version of C64 BASIC.

                for example:
                C64 BASIC Functions

                DEF FN foo(x) = x*x
                

                GW-BASIC Functions

                //GW-BASIC Functions can have more arguments
                //While C64 BASIC only allows one Numerical argument.
                DEF FNmax(x,y) = x*(x>y)+(y>x)*y
                

                So for example, to move the cursor in GW-BASIC you just need to use the LOCATE x,y built in Function which moves the cursor at x,y coords.

                1 Reply Last reply Reply Quote 0
                • L
                  LucasJG25 last edited by

                  @NextWithoutFor yes.

                  1 Reply Last reply Reply Quote 0
                  • L
                    LucasJG25 last edited by LucasJG25

                    Ok. Managed to get this interpreter working. Still needs to be tested. But so far it works just like the old BASIC. Hope you guys have fun making text games with this. Arrays and user functions have not been implemented yet. I'm still learning how to build interpreters and compilers which is a pretty huge field but getting there slowly.

                    SHARE CODE: B6Y73MND9K (pending)

                    https://twitter.com/Lucas1904875369/status/1387147463203516417?s=19

                    EDIT: Changed the syntax of the language a bit. Arrays are now supported but now all variable must be declared once.

                    10 DIM A AS STRING
                    20 DIM B AS INTEGER
                    

                    The same is done for arrays.

                    30 DIM C(10) AS STRING
                    40 DIM D(20) AS INTEGER
                    
                    1 Reply Last reply Reply Quote 2
                    • AndyG1985
                      AndyG1985 last edited by

                      I just downloaded this, it’s a shame there’s no built-in keyboard as I don’t have one. I was wondering if I could animate Dizzy with binary and about 300 lines of code, as I used to do on my ZX!

                      L 1 Reply Last reply Reply Quote 0
                      • L
                        LucasJG25 @AndyG1985 last edited by

                        @AndyG1985 I'll see what i can do concerning a built in keyboard. More built in functions will be added soon.

                        1 Reply Last reply Reply Quote 1
                        • First post
                          Last post