Update README.md
Browse files
README.md
CHANGED
|
@@ -1,2 +1,53 @@
|
|
| 1 |
-
#
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Compiler
|
| 2 |
+
|
| 3 |
+
This is a simple C program named `compiler.c` that implements a recursive descent parser for evaluating arithmetic expressions.
|
| 4 |
+
|
| 5 |
+
## Description
|
| 6 |
+
|
| 7 |
+
The `compiler.c` file contains a basic implementation of a recursive descent parser for arithmetic expressions. It supports addition, subtraction, multiplication, and division operations, as well as parentheses for grouping expressions. The program reads an arithmetic expression entered by the user, evaluates it, and prints the result.
|
| 8 |
+
|
| 9 |
+
## Usage
|
| 10 |
+
|
| 11 |
+
To use the compiler, follow these steps:
|
| 12 |
+
|
| 13 |
+
1. Clone the repository:
|
| 14 |
+
|
| 15 |
+
```
|
| 16 |
+
git clone https://github.com/Ismat-Samadov/compiler.git
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
2. Navigate to the directory:
|
| 20 |
+
|
| 21 |
+
```
|
| 22 |
+
cd compiler
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
3. Compile the `compiler.c` file:
|
| 26 |
+
|
| 27 |
+
```
|
| 28 |
+
gcc compiler.c -o compiler
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
4. Run the compiled program:
|
| 32 |
+
|
| 33 |
+
```
|
| 34 |
+
./compiler
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
5. Enter an arithmetic expression when prompted.
|
| 38 |
+
|
| 39 |
+
6. The program will evaluate the expression and print the result.
|
| 40 |
+
|
| 41 |
+
## Example
|
| 42 |
+
|
| 43 |
+
Here's an example of using the compiler:
|
| 44 |
+
|
| 45 |
+
```
|
| 46 |
+
$ ./compiler
|
| 47 |
+
Enter an arithmetic expression: 5+3
|
| 48 |
+
Result: 8
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
## Contributing
|
| 52 |
+
|
| 53 |
+
Contributions to this project are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
|