Post Reply 
monic part 5: writing C programs on the calculator
01-01-2021, 01:35 AM (This post was last modified: 12-26-2022 11:58 PM by F-73P.)
Post: #1
monic part 5: writing C programs on the calculator
Previous: monic part 4: arbitrary-precision rational arithmetic

Next: monic part 6: the mC programming language and compiler

I've started writing an editor and translator for a subset of the C programming language. I'm not sure what the proper computer science term for the translator is. Given a program, e.g. find the factorial of the positive integer on stack level 1:

Code:

double product=1.0;
double n;

int main(void) {
 n = level1; //pop value on stack level 1 into n
 do {
  product = product*n;
  n--; 
 } while (n>1.0);
}

the translator produces a sequence of codes. When the program is run the codes are fed to a switch statement, which executes the corresponding instruction. Does this make the translator a compiler, or is it an interpreter?

The C language combines all the power of assembly language with all the ease-of-use of assembly language
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
monic part 5: writing C programs on the calculator - F-73P - 01-01-2021 01:35 AM



User(s) browsing this thread: 1 Guest(s)