Results 1 to 10 of 33

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

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    ... continued

    In terms of status, right now I'm still struggling with getting my expression evaluation engine in place; I figured i'd tackle one of the toughest parts first. The tokenizer for expressions is working stellar, but I'm having trouble with function calls...

    3+(-2) returns 1, correct
    3+abs(-2) returns 5, correct
    (-2)+3 returns 1, correct
    abs(-2)+3 returns -5... WRONG.

    It's literally ignoring the closing parenthesis... I'm probably overlooking the obvious. Even with this minor bug it handles complex formula:

    5*(a-3)+2^8+6*b

    flawlessly. Function calls also run quickly because the tokenizer is compiling to state-based lookups, meaning when the interpreter gets to the token for a function, the next byte is an array index into the function list -- so I can call it thus:

    functionList[currentData^]^(expression);

    Where currentData^ is the current byte stored in the code, and expression is the function to evaluate what's inside the function call.

    The expression engine is a simple three stage expression/factor/value system... you call expression, it calls factor, which first calls value to, well... get a value to work with. Value checks to see if we're pulling an immediate, a function, or a variable, returns kind... factor then checks for a 'second stage' operator like multiply/divide/exponent, if present pulls a value and does it, if not it returns to expression which checks for first stage operations (addition/subtraction) and does those, again calling factor for their values.

    It's how I did it all those ages ago when I wrote a Clipper interpreter in DiBol (I should track down the code for that)... tried and true method. I think it's even how Prof. Wirth did it in his p-code interpreter. (as opposed to C with it's 17 stage nightmare)

    Means a wee bit of nesting, but nothing FPC can't handle.

    So the code is coming slowly. I'm working up a website for the project and hope to soon get that up live... but I've not really set up a time limit on getting this into the beta stage. I may release some binary demos before this goes beta, but for now I'm keeping the code private as, well... during development I don't work well with others. Once I have it to the point of text mode and input handling complete, I'll be opening up the code to the public.

    I have had suggestions to make a Kickstarter page for it. I'd like to get something to show for actual working tokenizer (read "caching bytecode compiler" in 'modernspeak') and interpreter first.

    Was also thinking on making the IDE web-aware, so kids could easily share their games online with others.

    So... good idea, crazy idea, who cares? Any ideas/suggestions welcome... well -- apart from "oh just write a book about python" or "why don't you make a UML implementation", in which case bugger off! Dealt with that already in two different places, and to me that's a sign that said individuals don't get the concept.

    Sorry for the long post... Wait, no I'm not; The TLDR crowd can kiss right off too!
    The accessibility of a website from time to time must be refreshed with the blood of designers and owners. It is its natural manure

  2. #2
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25
    An interesting proposal. I think that anything that helps kids learn to program is great.

    There was a programming compiler/interpreter called Turing, named after Alan Turing, by some students at University of Toronto in Canada. It was used by many of the high schools in Toronto, including mine, to teach young people how to program. It took the medium to low level coding of the day and brought it up to a high level of code writing. It also took away much of the low level stuff you needed to do to add sound and graphics.

    I think that's important! Having an all in one solution so that new programmers don't have to learn "rocket science" before they learn how to simply "put a nail into a wooden board" at the beginning of everything they have to learn. It sort of kills the path to learning this great art form called programming.
    Jason McMillen
    Pascal Game Development
    Co-Founder





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
  •