Move the entire interface-design to readme.txt (my eyes, just get it away)

This commit is contained in:
mino 2014-04-21 13:59:25 +02:00
parent d7feff00ed
commit 936739242a
2 changed files with 133 additions and 121 deletions

View file

@ -1,120 +0,0 @@
Interface Design Sheet for Scanner
==================================
Scanner
=======
Task:
Communicates with all parties to produce a token on each step.
It is the major interface to parser.
Interface IN:
token Scanner::nextToken() // returns a token with all neccessary info to the parser until EOF
Interface OUT:
char Buffer::getChar( void ) // buffer returns next char
void Buffer::ungetChar( int len ) // buffer ungets char for amount of len
char *Buffer::getLexem( void ) // buffer returns pointer to current lexem (null terminated, c_string style TODO see end of this file for more)
int Buffer::getColumn( void ) // buffer returns current column
int Buffer::getLine( void ) // buffer returns current line
void Buffer::setNewLexem( void ) // informs buffer that a new lexem is about to be scanned
bool Automaton::readChar( char ch ) // bool indicates the scanner that the automaton has recognized a token and it can be caught by the scanner
tokentype Automaton::getTokenType( void ) // returns last recognized tokentype to scanner
int Automaton::getBack( void ) // returns back variable which indicates to scanner how many chars it needs to instruct buffer to ungetChar()
Buffer
======
Task:
Service provider to Scanner. Concerned with reading in and buffering input
file and lexem info. It records current parsed lexem, its column and row info.
It also indicates EOF. Is controlled by scanner.
Interface IN:
char Buffer::getChar( void ) // buffer returns next char
void Buffer::ungetChar( int len ) // buffer ungets char for amount of len
char *Buffer::getLexem( void ) // buffer returns pointer to current lexem (null terminated, c_string style TODO see end of this file for more)
int Buffer::getColumn( void ) // buffer returns current Column
int Buffer::getRow( void ) // buffer returns current row
void Buffer::setNewLexem( void ) // informs buffer that a new lexem is about to be scanned
Interface OUT:
<none>, maybe the low-level read functions to OS, when constructor is called
and it reads in the input file.
Automaton
=========
Task:
Service provider to Scanner. Accepts lexemes from source language as defined in
SysprogI.pdf page 41. Indicates which tokentype a lexeme belongs to and outputs
last recognized token type to scanner.
Interface IN:
bool Automaton::readChar( char ch ) // bool indicates the scanner that the automaton has recognized a token and it can be caught by the scanner
tokentype Automaton::getTokenType( void ) // returns last recognized tokentype to scanner
int Automaton::getBack( void ) // returns back variable which indicates to scanner how many chars it needs to instruct buffer to ungetChar()
Interface OUT:
<none>
Symboltable
===========
Task:
Service provider to Scanner. Store every variable with each one's value and
can return it when asked by the scanner
Interface IN:
void Symboltable::setIdentifier(string name, int value)
bool Symboltable::identifierExists(string name)
int Symboltable::getValue(string name)
Interface OUT:
int Symboltable::hash([string|int|...] seed) // TODO choose the seed
Coding Conventions:
===================
int function
{
if() {
} else {
}
for() {
}
while() {
}
}
// tab = 4 spaces
// text width = 80
TODO
====
- ask if we are allowed to use #include <string>, if so we might change buffer interface from * char to string
(see page 2)
- symboltable
-

View file

@ -1,3 +1,12 @@
/*
===========================================================================
MAKEFILE STUFF
===========================================================================
*/
Das Projekt wurde in 4 Teilprojekte aufgeteilt:
- Automat
@ -71,4 +80,127 @@ den Pfad zum Verzeichnis der shared library an das Ende anhängen, trennen mit ;
http://www.sethi.org/classes/cet375/lab_notes/lab_04_makefile_and_compilation.html
http://mrbook.org/tutorials/make/
http://mrbook.org/tutorials/make/
/*
===========================================================================
INTERFACE DESIGN
===========================================================================
*/
Scanner
=======
Task:
Communicates with all parties to produce a token on each step.
It is the major interface to parser.
Interface IN:
token Scanner::nextToken() // returns a token with all neccessary info to the parser until EOF
Interface OUT:
char Buffer::getChar( void ) // buffer returns next char
void Buffer::ungetChar( int len ) // buffer ungets char for amount of len
char *Buffer::getLexem( void ) // buffer returns pointer to current lexem (null terminated, c_string style TODO see end of this file for more)
int Buffer::getColumn( void ) // buffer returns current column
int Buffer::getLine( void ) // buffer returns current line
void Buffer::setNewLexem( void ) // informs buffer that a new lexem is about to be scanned
bool Automaton::readChar( char ch ) // bool indicates the scanner that the automaton has recognized a token and it can be caught by the scanner
tokentype Automaton::getTokenType( void ) // returns last recognized tokentype to scanner
int Automaton::getBack( void ) // returns back variable which indicates to scanner how many chars it needs to instruct buffer to ungetChar()
Buffer
======
Task:
Service provider to Scanner. Concerned with reading in and buffering input
file and lexem info. It records current parsed lexem, its column and row info.
It also indicates EOF. Is controlled by scanner.
Interface IN:
char Buffer::getChar( void ) // buffer returns next char
void Buffer::ungetChar( int len ) // buffer ungets char for amount of len
char *Buffer::getLexem( void ) // buffer returns pointer to current lexem (null terminated, c_string style TODO see end of this file for more)
int Buffer::getColumn( void ) // buffer returns current Column
int Buffer::getRow( void ) // buffer returns current row
void Buffer::setNewLexem( void ) // informs buffer that a new lexem is about to be scanned
Interface OUT:
<none>, maybe the low-level read functions to OS, when constructor is called
and it reads in the input file.
Automaton
=========
Task:
Service provider to Scanner. Accepts lexemes from source language as defined in
SysprogI.pdf page 41. Indicates which tokentype a lexeme belongs to and outputs
last recognized token type to scanner.
Interface IN:
bool Automaton::readChar( char ch ) // bool indicates the scanner that the automaton has recognized a token and it can be caught by the scanner
tokentype Automaton::getTokenType( void ) // returns last recognized tokentype to scanner
int Automaton::getBack( void ) // returns back variable which indicates to scanner how many chars it needs to instruct buffer to ungetChar()
Interface OUT:
<none>
Symboltable
===========
Task:
Service provider to Scanner. Store every variable with each one's value and
can return it when asked by the scanner
Interface IN:
void Symboltable::setIdentifier(string name, int value)
bool Symboltable::identifierExists(string name)
int Symboltable::getValue(string name)
Interface OUT:
int Symboltable::hash([string|int|...] seed) // TODO choose the seed
Coding Conventions:
===================
int function
{
if() {
} else {
}
for() {
}
while() {
}
}
// tab = 4 spaces
// text width = 80
TODO
====
- ask if we are allowed to use #include <string>, if so we might change buffer interface from * char to string
(see page 2)
- symboltable
- public header for parser