Saturday, December 19, 2009

Time To Get Started

I'm anxious to get started coding.  I have a bunch of notes scratched down on the various parts of the interactive compiler.  I wanted to have a long discussion on GOTOs (essentially what they are used for and how structured elements of a programming language can eliminate their need).  But I'll go into this as I discuss the specific implementation of the BASIC commands as needed.  Before coding begins, some organization and planning are needed for the basic components.  Right now I see the basic components as follows:
  1. LANGUAGE – definition of the language elements.
  2. INTERNAL LANGUAGE – the way the program is stored in memory.
  3. PARSER – parses the lines into tokens.
  4. TRANSLATOR – translates the tokens into RPN elements.
  5. EXPRESSIONS – part of the translator that processes expressions.
  6. ENCODER – encodes the RPN elements into the internal language.
  7. RECREATOR – recreates the origin source from the internal language.
  8. RUNTIME – runs the program.
The internal language for each command and expression element needs to be defined before the source program can be encoded.  The goal is the run time module execute the program as fast as possible.  The RPN format aids in this.  The translator and encoder should do as much work as possible so that the run time module does not have too.

The translator, expression, encoder, re-creator and run time modules are require stacks, lists and/or queues in some form as will been seen as the design of each is developed.  Stacks, queues and lists are very similar except how elements are added and removed.  This is where I will start – developing code to implement stacks and lists.

No comments:

Post a Comment

All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)