Results 1 to 10 of 33

Thread: Gumberoo - Making a new learning language intepreter using FPC

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Update...

    Expression engine complete. Was a stupid mistake where I was treating the function as a expression start, while stilll tokeinizing the opening (

    So the problem WAS in the tokenizer after all. Finally, I can move on to actual line processing/execution, and variables.

    Though I also just belted out a couple test constants. PI and Deg2Rad.

    Deg2Rad=PI/180. You multiply degrees by that to turn it into radians... though since I'm NOT going to make SIN/COS/Arctan use radians, I guess that one's kinda pointless.

    Still, it's really cool to see it finally evaluate:

    Code:
    Enter expression or blank line to quit >64*sin(45*pi/180)+160
    result: 205.25483400
    From here should be smooth sailing, I actually consider that the hardest part of writing an interpreter. It even has error handling:
    Code:
    Enter expression or blank line to quit >160+64*sin(45*pi/180
    processing: 160+64*sin(45*pi/180
    Error in Expression: Closing Bracket Missing
      160+64*sin(45*pi/180
                         ^
    Which that's done at the tokenizer, so the actual interpreter part would never even get that code to try and run it. In the final version I plan for the EDITOR to not allow you to add such a line without fixing the error first.
    Last edited by deathshadow; 15-04-2012 at 08:00 PM.
    The accessibility of a website from time to time must be refreshed with the blood of designers and owners. It is its natural manure

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •