flat assembler
Message board for the users of flat assembler.

Index > Projects and Ideas > Interpreter and IDE - looking for ideas

Author
Thread Post new topic Reply to topic
adroit



Joined: 21 Feb 2010
Posts: 252
adroit 16 Dec 2010, 02:58
I have been planning to make a simple calculator. It will do simple addition, subtraction, multiplication, division and exponential arithmetic. It will be able to calculate integers (no signed [unary] integers). It will be also able to calculate rational numbers (if I can implement it). The program will have two ways to interact with the user, by command-line and through a script processing

There are three simple commands that are supported here:
    1. PRINT - display a value to screen
    2. CLEAR - clear the screen
    3. END - end the program


command-line example:

    print 10 + 23 + 17

print the sum directly through PRINT
Script example:
    a = 10
    b = 23
    c = 17
    sum = a + b + c
    print sum

print the total from the variable, sum

Can anyone help me the concepts behind interpreting. [I've have been trying to create my own small interpreter but I've be unsuccessful]. Thanks in advance.

_________________
meshnix
Post 16 Dec 2010, 02:58
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4043
Location: vpcmpistri
bitRAKE 16 Dec 2010, 13:40
You are building a tree starting at the leaves - like looking down on the orchard. The user/script will state where the branches are, and finally the trunks (when some output is needed). Nothing is really done until a complete tree is defined - just build internal state - links between objects.

It's up to you how this is implemented. Could just create a table of left-side operand pointers (into the script, where they are defined). This table is searched to trace the tree backward (up the branches to the leaves), then forward again - collapsing all the branches.
Post 16 Dec 2010, 13:40
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4339
Location: Now
edfed 16 Dec 2010, 14:13
you can try to do the calculation interface from TI 80, 81, 82, 83, 83+ etc...
not the casio interface because it sucks

i think it is far more interresting to emulate a very good calculator than to try to invent a new one.

that's one of my projects to do a TI calculator interface.

then:
Code:
X=54345 "enter"
                          54345
A=X*543 "enter"
                          29509335
A+X "enter"
                          29509878
    
Post 16 Dec 2010, 14:13
View user's profile Send private message Visit poster's website Reply with quote
adroit



Joined: 21 Feb 2010
Posts: 252
adroit 02 Jan 2011, 02:54
brilliant! not a bad idea. I'll try to emulate a calculator. Good luck on that project.
Post 02 Jan 2011, 02:54
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 02 Jan 2011, 03:40
To bad it's already been done. Razz TiEmu is a very good TI emulator, and can emulate almost all TIs given a ROM(which you can dl from TI's website, as a ROM update)
Post 02 Jan 2011, 03:40
View user's profile Send private message Reply with quote
adroit



Joined: 21 Feb 2010
Posts: 252
adroit 06 Jan 2011, 02:41
But its still good to try to attempt it.
Post 06 Jan 2011, 02:41
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4339
Location: Now
edfed 06 Jan 2011, 09:05
of course, because even if the car still exist, it is not a reason to don't try to reinvent it, as renault do since 10 years now about electric cars. Very Happy

and there are not good fasm based graphic calculator, then, it is enough to add it to the todo list Smile
Post 06 Jan 2011, 09:05
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.