flat assembler
Message board for the users of flat assembler.

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

Joined: 21 Feb 2010
Posts: 252
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
16 Dec 2010, 02:58
bitRAKE

Joined: 21 Jul 2003
Posts: 3018
Location: vpcmipstrm
bitRAKE
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.
16 Dec 2010, 13:40
edfed

Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
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
```
16 Dec 2010, 14:13

Joined: 21 Feb 2010
Posts: 252
brilliant! not a bad idea. I'll try to emulate a calculator. Good luck on that project.
02 Jan 2011, 02:54
Tyler

Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler
To bad it's already been done. 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)
02 Jan 2011, 03:40

Joined: 21 Feb 2010
Posts: 252
But its still good to try to attempt it.
06 Jan 2011, 02:41
edfed

Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
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.

and there are not good fasm based graphic calculator, then, it is enough to add it to the todo list
06 Jan 2011, 09:05
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainTutorials and ExamplesDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsOS ConstructionIDE DevelopmentProjects and IdeasNon-x86 architecturesHigh Level LanguagesProgramming Language DesignCompiler Internals Other----------------FeedbackHeapTest Area

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum