diff options
author | scratko <m@scratko.xyz> | 2024-04-02 02:03:57 +0300 |
---|---|---|
committer | scratko <m@scratko.xyz> | 2024-04-02 02:03:57 +0300 |
commit | 80749242cc6aa604c6ee3a7e3169df73c14e55d2 (patch) | |
tree | bfc4db5b1b209d81dca539588350ac7b8cfab13e /README.md | |
parent | 8a704989e2d4733e6e847cb272a40dd85de4c9cd (diff) | |
download | arithmetic-expression-computator-master.tar.gz arithmetic-expression-computator-master.tar.bz2 arithmetic-expression-computator-master.zip |
Corrected description.
Fixed pointer symbol in some places.
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -5,7 +5,24 @@ ## Introduction Remarkably, this program is written in C without using library features at all. -Assembler modules are used for program entry point and system call wrappers. +This means that even the standard C library is not involved in the program. One +of the main properties of C language is zero runtime. This term emphasizes zero +size of the runtime library, i.e. the part of the library that is necessarily +contained in all executable files created by a particular compiler. + +Assembler modules are written for program entry point and system call wrappers. +For writing and reading (standard output/input stream) -- `sys_read` and +`sys_write`. Also to terminate the program with a return code (assume in case of an +error) -- `sys_exit`. In addition, a primitive dynamic memory (heap) management +system is created. When an element is added to the stack, it checks the +availability of free addresses in the heap (which were previously allocated but +then freed). When an element is removed from the stack, the current address +from the heap is marked free so that it can be occupied later. + +Assembler functions `sys_alloc` and `sys_free` are written to allocate and free +memory. They invoke system call brk(), which has number 45. + +## About algorithm This program is based on two algorithms: reverse polish notation (RPN) and Dijkstra's algorithm. @@ -27,7 +44,7 @@ operands as well as operation symbols (again, in some cases) are inserted into the RPN stack. The algorithm is described in more detail in the book А.В. Столяров "Программирование: введение в профессию" (том 1, ДМК Пресс, стр. 644). -## Building and usagea +## Building and usage ``` git clone https://git.scratko.xyz/arithmetic-expression-computator @@ -38,6 +55,7 @@ Launch the program `./arith_exp` After starting, enter an arithmetic expression. Notes: + - the expression must not contain any space characters - negative values must be surrounded by brackets - you can see an example of the expression on the screenshot above. |