|
1 | | -# Autor: Jakub Jaśków - 268416 |
2 | | -# Instrukcja obsługi kompilatora |
3 | | -## Kompilacja |
4 | | -### Niezbędne programy |
5 | | -Kompilacja programu testowana była pod poniżej wymienionymi wersjami programów. Zaleca się stosowanie tych samych wersji oprogramowania. |
| 1 | +# Author: Jakub Jaśków - 268416 |
| 2 | +# Compiler manual |
| 3 | +[](README.md) |
| 4 | +[](README.pl.md) |
| 5 | +## Project compilation |
| 6 | +### Necessary programs |
| 7 | +It's recommended to build the project with the same or newer program versions than the ones listed belowe. |
6 | 8 | + Bison - 3.8.2 |
7 | 9 | + Flex - 2.6.4 |
8 | 10 | + g++ - 11.4.0 |
9 | 11 | + GNU Make - 4.3 |
10 | 12 |
|
11 | | -### Kompilacja programu |
12 | | -Aby skompilować program należy umieścić wszystkie pliki wymienione w sekcji **[Pliki](#pliki)** w jednym folderze a następnie wywołać następujące komendy: |
| 13 | +### Building the compiler |
| 14 | +>\$ cd my_compiler/\ |
| 15 | +>\$ make |
13 | 16 |
|
14 | | ->$ make |
| 17 | +After building the project, you will get a binary file called **compiler**. |
15 | 18 |
|
16 | | -Po kompilacji otrzymamy plik binarny o nazwie **compiler**. |
| 19 | +### Compiler usage |
17 | 20 |
|
18 | | -Usuwanie plików utworzonych podczas budowania: |
19 | | ->$ make clean-all |
| 21 | +>$ ./compiler [OPTION] [INPUT_FILE] [OUTPUT_FILE] |
| 22 | +
|
| 23 | +#### Options: |
20 | 24 |
|
21 | | -### Użytkowanie programu |
| 25 | + -v verbose - will write all info/logs to standard output. |
22 | 26 |
|
23 | | ->$ ./compiler [OPCJA] [PLIK_WEJŚCIOWY] [PLIK_WYJŚCIOWY] |
| 27 | +**ATTENTION!** |
| 28 | +Always remember to grant execution rights to the binary file (**compiler**). How it's done on **LINUX**: |
24 | 29 |
|
25 | | -##### Opcje: |
| 30 | +>$ chmod u+x [FILE_NAME] |
26 | 31 |
|
27 | | - -v tryb verbose - drukuje wszystkie logi na standardowe wyjście. |
| 32 | +### Cleaning |
28 | 33 |
|
29 | | -**UWAGA!** |
30 | | -Czasami otrzymany przez nas plik może nie chcieć się wykonać. Może to być spowodowane brakiem zezwolenia na wykonanie od strony systemu operacyjnego. Należy wtedy nadać plikowi binarnemu (**compiler**) odpowiednie prawa wykonawcze. **LINUX**: |
| 34 | +Clean all build files: |
| 35 | +>$ make clean-all |
31 | 36 |
|
32 | | ->$ chmod a+x [nazwa_pliku] |
| 37 | +## Files |
| 38 | ++ **grammar.y**, **lexer.lex** - definitions of lexical analyser and parser. Includes: grammar, keywords and functions from other files. |
33 | 39 |
|
34 | | -## Pliki |
35 | | -+ **grammar.y**, **lexer.lex** - pliki definiujące analizatora leksykalnego i parsera. Zawierają: gramatykę, słowa kluczowe oraz funkcje z innych plików. |
| 40 | ++ **grammar.cpp**, **grammar.hpp**, **lexer.cpp** - precompiled versions of files listed above. Generated by parser and lexer. |
36 | 41 |
|
37 | | -+ **grammar.cpp**, **grammar.hpp**, **lexer.cpp** - prekompilowane wersje powyższych plików wygenerowanie przez parser i lekser. |
| 42 | ++ **CodeBlock.hpp**, **AST.hpp**, **AST.cpp** - headers and sources of various compiler elements. **CodeBlock.hpp** includes the definition of a code block and structures/elements used. **AST.hpp** and **AST.cpp** - define structures and classes used for construction of AST (Abstract Syntax Tree) and translation of tree nodes to pseudo assembler code. |
38 | 43 |
|
39 | | -+ **CodeBlock.hpp**, **AST.hpp**, **AST.cpp** - nagłowki i źródła elementów programu. **CodeBlock.hpp** zawiera definicje code blocku oraz elementów w nim używanych. **AST.hpp** i **AST.cpp** - definiują struktury i klasy używane podczas konstrukcji drzewa AST oraz tłumaczenia elementów drzewa na kod maszyny wirtualnej (pesudo assembler). |
| 44 | ++ **handlers.hpp**, **handlers.cpp** - definitions and declarations of functions responsible for handling the construction of an AST and semantic checks (variable initialization etc.). |
40 | 45 |
|
41 | | -+ **handlers.hpp**, **handlers.cpp** - definicje i deklaracje funkcji obłsługujących tworzenie elementów drzewa AST oraz sprawdzania poprawnej semantyki programów (sprawdzanie inicjalizacji zmiennych itp.). |
| 46 | ++ **definitions.hpp** - macros and definitions used by multiple files. |
42 | 47 |
|
43 | | -+ **definitions.hpp** - deklaracje używane przez wiele plików oraz makra |
| 48 | ++ **types.hpp** - mixed definition of an AST and a code block |
44 | 49 |
|
45 | | -+ **types.hpp** - łączona definicja CodeBlocku oraz AST |
| 50 | ++ **main.cpp** - definition and declaration of main, error and warning functions. Defines in what order the code compilation is done. |
46 | 51 |
|
47 | | -+ **main.cpp** - definicja i deklaracja funkcji main, error, warning oraz kolejności wykonywania części programu |
| 52 | +[](README.md) |
| 53 | +[](README.pl.md) |
0 commit comments