Skip to content

Commit

Permalink
refactor: Update project directory structure
Browse files Browse the repository at this point in the history
This commit reorganizes the project directory structure to improve clarity and maintainability. Changes include:

- Moving files to more appropriate directories
- Renaming directories for consistency
- Updating import statements and references accordingly

These changes aim to make it easier for developers to navigate the project and locate relevant files. No functionality has been altered in this commit.
  • Loading branch information
UchihaIthachi committed Apr 18, 2024
1 parent b32e760 commit cd56ff2
Show file tree
Hide file tree
Showing 47 changed files with 188 additions and 180 deletions.
16 changes: 8 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"python.analysis.extraPaths": [
"${workspaceFolder}/utils/",
"${workspaceFolder}/errors_handling/",
"${workspaceFolder}/lexical_analysis/",
"${workspaceFolder}/table_routines/",
"${workspaceFolder}/screener/",
"${workspaceFolder}/parser/",
"${workspaceFolder}/cse_machine/",
"${workspaceFolder}/interpreter/",
"${workspaceFolder}/src/utils/",
"${workspaceFolder}/src/errors_handling/",
"${workspaceFolder}/src/lexical_analysis/",
"${workspaceFolder}src//table_routines/",
"${workspaceFolder}/src/screener/",
"${workspaceFolder}/src/parser/",
"${workspaceFolder}/src/cse_machine/",
"${workspaceFolder}/src/interpreter/",
"${workspaceFolder}/rpal_tests/"

]
Expand Down
41 changes: 20 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,10 @@ run: install myrpal.py test.txt
# define test targets for the RPAL interpreter
############################################################################################################

R = 1
# Run normal tests
test:
@echo "Running tests...$(OS)"
@if [ "$(OS)" = "Windows_NT" ] && [ "$(R)" = "" ]; then \
@if [ "$(OS)" = "Windows_NT" ] && [ "$(R)" = " " ]; then \
if [ "$(F)" = "" ]; then \
$(PYTHON) -m pytest -v --no-summary rpal_tests/test_generate_tests_with_rpal_exe.py ; \
else \
Expand All @@ -126,59 +125,59 @@ test:
# Run a specific test with parameters
test_st:
@echo "Running tests...$(OS)"
@if [ "$$(uname -s)" = "Linux" ] && [ -z "$(R)" ]; then \
@if [ "$(OS)" = "Windows_NT" ] && [ "$(R)" = " " ]; then \
if [ "$(F)" = "" ]; then \
$(PYTHON) -m pytest -v --no-summary rpal_tests/test_generate_st_tests.py ; \
$(PYTHON) -m pytest -v --no-summary rpal_tests/test_generate_st_tests_with_rpal_exe.py ; \
else \
$(PYTHON) -m pytest -v -k "$(F)" rpal_tests/test_generate_st_tests.py -vvv --tb=short; \
$(PYTHON) -m pytest -v -k "$(F)" rpal_tests/test_generate__st_tests_with_rpal_exe.py -vvv --tb=short; \
fi \
else \
if [ "$(F)" = "" ]; then \
$(PYTHON) -m pytest -v --no-summary rpal_tests/test_generate_st_tests_with_rpal_exe.py ; \
$(PYTHON) -m pytest -v --no-summary rpal_tests/test_generate_st_tests.py ; \
else \
$(PYTHON) -m pytest -v -k "$(F)" rpal_tests/test_generate_st_tests_with_rpal_exe.py -vvv --tb=short; \
$(PYTHON) -m pytest -v -k "$(F)" rpal_tests/test_generate_st_tests.py -vvv --tb=short; \
fi \
fi

# Run a specific test with parameters
test_ast:
@echo "Running tests...$(OS)"
@if [ "$$(uname -s)" = "Linux" ] && [ -z "$(R)" ]; then \
@if [ "$(OS)" = "Windows_NT" ] && [ "$(R)" = " " ]; then \
if [ "$(F)" = "" ]; then \
$(PYTHON) -m pytest -vv --no-summary rpal_tests/test_generate_ast_tests.py ; \
$(PYTHON) -m pytest -v --no-summary rpal_tests/test_generate_ast_tests_with_rpal_exe.py ; \
else \
$(PYTHON) -m pytest -vv -k "$(F)" rpal_tests/test_generate_ast_tests.py -vvv --tb=short; \
$(PYTHON) -m pytest -v -k "$(F)" rpal_tests/test_generate__ast_tests_with_rpal_exe.py -vvv --tb=short; \
fi \
else \
if [ "$(F)" = "" ]; then \
$(PYTHON) -m pytest -vv --no-summary rpal_tests/test_generate_ast_tests_with_rpal_exe.py ; \
$(PYTHON) -m pytest -v --no-summary rpal_tests/test_generate_ast_tests.py ; \
else \
$(PYTHON) -m pytest -vv -k "$(F)" rpal_tests/test_generate_ast_tests_with_rpal_exe.py -vvv --tb=short; \
$(PYTHON) -m pytest -v -k "$(F)" rpal_tests/test_generate_ast_tests.py -vvv --tb=short; \
fi \
fi

test_all:
@echo "Running tests...$(OS)"
@if [ "$$(uname -s)" = "Linux" ] && [ -z "$(R)" ]; then \
@if [ "$(OS)" = "Windows_NT" ] && [ "$(R)" = " " ]; then \
echo "=========================================================================================================="; \
echo "Running tests for Abstract Syntax Tree (AST):"; \
$(PYTHON) -m pytest rpal_tests/test_generate_ast_tests_with_rpal_exe.py ; \
$(PYTHON) -m pytest -q --no-summary rpal_tests/test_generate_ast_tests_with_rpal_exe.py ; \
echo "=========================================================================================================="; \
echo "Running tests for Standardized Syntax Tree (ST):"; \
$(PYTHON) -m pytest rpal_tests/test_generate_st_tests_with_rpal_exe.py ; \
$(PYTHON) -m pytest -q --no-summary rpal_tests/test_generate_st_tests_with_rpal_exe.py ; \
echo "=========================================================================================================="; \
echo "Running tests:"; \
$(PYTHON) -m pytest rpal_tests/test_generate_tests_with_rpal_exe.py ; \
echo "Running tests :"; \
$(PYTHON) -m pytest -q --no-summary rpal_tests/test_generate_tests_with_rpal_exe.py ; \
else \
echo "=========================================================================================================="; \
echo "Running tests for Abstract Syntax Tree (AST):"; \
$(PYTHON) -m pytest -q --no-summary rpal_tests/test_generate_ast_tests_with_rpal_exe.py ; \
$(PYTHON) -m pytest -q --no-summary rpal_tests/test_generate_ast_tests.py ; \
echo "=========================================================================================================="; \
echo "Running tests for Standardized Syntax Tree (ST):"; \
$(PYTHON) -m pytest -q --no-summary rpal_tests/test_generate_st_tests_with_rpal_exe.py ; \
$(PYTHON) -m pytest -q --no-summary rpal_tests/test_generate_st_tests.py ; \
echo "=========================================================================================================="; \
echo "Running tests :"; \
$(PYTHON) -m pytest -q --no-summary rpal_tests/test_generate_tests_with_rpal_exe.py ; \
echo "Running tests:"; \
$(PYTHON) -m pytest -q --no-summary rpal_tests/test_generate_tests.py ; \
fi

############################################################################################################
Expand Down
155 changes: 78 additions & 77 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,90 +227,91 @@ The RPAL interpreter project is structured into several components, each respons

```bash
RPAL-Interpreter/
├── myrpal.py # Main entry point of the application
├── myrpal.py # Main entry point of the RPAL interpreter application
|
├── lexical_analyzer/ # Package for lexical analysis functionality
│ ├── scanner.py # Module containing lexical scanner logic
│ └── __init__.py # Marks the directory as a Python package
├── src/ # Source code directory
| ├── lexical_analyzer/ # Package for lexical analysis functionality
| │ ├── scanner.py # Module containing logic for the lexical scanner
| │ └── __init__.py # Marks the directory as a Python package
| |
| ├── screener/ # Package for screening functionality
| │ ├── screener.py # Module containing logic for screening
| │ └── __init__.py # Marks the directory as a Python package
| |
| ├── parser/ # Package for parsing functionality
| │ ├── build_standard_tree.py # Module for converting Abstract Syntax Tree (AST) to standard tree
| │ ├── parser_module.py # Module containing parser logic (converts tokens to AST)
| │ └── __init__.py # Marks the directory as a Python package
| |
| ├── cse_machine/ # Package for CSE (Compiled Stack Environment) machine functionality
| │ ├── apply_operations/ # Package for applying operations in the CSE machine
| │ │ ├── apply_bi.py # Module for applying binary operations
| │ │ ├── apply_un.py # Module for applying unary operations
| │ │ └── __init__.py # Marks the directory as a Python package
| │ ├── data_structures/ # Package for data structures used in the CSE machine
| │ │ ├── enviroment.py # Module for environment data structures
| │ │ ├── stack.py # Module for stack data structure
| │ │ ├── control_structure.py # Module for control structure data structure
| │ │ └── __init__.py # Marks the directory as a Python package
| │ ├── utils/ # Package for utilities used in the CSE machine
| │ │ ├── STlinearlizer.py # Module for linearizing the standard tree
| │ │ ├── util.py # Module for utility functions for the CSE machine
| │ │ └── __init__.py # Marks the directory as a Python package
| │ ├── machine.py # Module for the CSE machine
| │ └── __init__.py # Marks the directory as a Python package
| |
| ├── interpreter/ # Package for interpreter functionality
| │ ├── execution_engine.py # Module containing the logic for the RPAL interpreter
| │ └── __init__.py # Marks the directory as a Python package
| |
| ├── error_handling/ # Package for error handling functionality
| │ ├── error_handler.py # Module containing logic for error handling
| │ └── __init__.py # Marks the directory as a Python package
| |
| ├── table_routines/ # Package for table routines functionality
| │ ├── char_map.py # Module containing logic for character mapping
| │ ├── fsa_table.py # Module containing logic for Finite State Automaton (FSA) table
| │ ├── accept_states.py # Module containing logic for accept states
| │ ├── keywords.py # Module containing set of keywords
| │ └── __init__.py # Marks the directory as a Python package
| |
| ├── utils/ # Package for utility functionalities
| │ ├── tokens.py # Module containing token class definition
| │ ├── node.py # Module containing node data structure class definition
| │ ├── stack.py # Module containing stack class definition
| │ ├── token_printer.py # Module containing token printing function (for debugging purposes)
| │ ├── tree_printer.py # Module containing tree printing function (for debugging purposes)
| │ ├── tree_list.py # Module for listing tree elements
| │ ├── file_handler.py # Module containing file handling functions
| │ └── __init__.py # Marks the directory as a Python package
|
├── screener/ # Package for screening functionality
│ ├── screener.py # Module containing screening logic
│ └── __init__.py # Marks the directory as a Python package
├── rpal_tests/ # Directory for tests
| ├── rpal_sources/ # Directory for RPAL source code files to test
| ├── test_generate_tests.py # Module for generating tests
| ├── test_generate_ast_tests.py # Module for generating tests in rpal_sources by pytest for AST
| ├── test_generate_st_tests.py # Module for generating tests in rpal_sources by pytest for standard tree
| ├── test_generate_tests_with_rpal_exe.py # Module for generating tests in rpal_sources by pytest output generated by real rpal.exe
| ├── test_generate_ast_tests_with_rpal_exe.py # Module for generating tests in rpal_sources by pytest for AST output generated by real rpal.exe
| ├── test_generate_st_tests_with_rpal_exe.py # Module for generating tests in rpal_sources by pytest for standard tree output generated by real rpal.exe
| ├── assert_program .py # Module for checking tests
| ├── program_name_list.py # List of program names in rpal_sources directory
| ├── output.py # List of outputs generated by rpal.exe
| ├── output_ast.py # List of AST outputs generated by rpal.exe
| ├── output_st.py # List of standard tree outputs generated by rpal.exe
| ├── rpal.exe # RPAL interpreter
| ├── cygwin1.dll # Cygwin DLL required for execution (if applicable)
| └── __init__.py # Marks the directory as a Python package
|
├── parser/ # Package for parsing functionality
│ ├── build_standard_tree.py # Module for converting AST to standard tree
│ ├── parser_module.py # Module containing parser logic (filter token to AST)
│ └── __init__.py # Marks the directory as a Python package
├── doc/ # Directory for documentation files
|
├── cse_machine/ # Package for parsing functionality
│ ├── apply_operations/ # Package for applying operations
│ │ ├── apply_bi.py # Module for applying binary operations
│ │ ├── apply_un.py # Module for applying unary operations
│ │ └── __init__.py # Marks the directory as a Python package
│ ├── data_structures/ # Package for data structures to cse machine
│ │ ├── enviroment.py # Module for enviroment data structures
│ │ ├── stack.py # Module for stack
│ │ ├── control_structure.py # Module for control structure
│ │ └── __init__.py # Marks the directory as a Python package
│ ├── utils/ # Package for utilities to cse machine
│ │ ├── STlinearlizer.py # Module for linearlizer the standard tree
│ │ ├── util.py # Module for utilities functions for cse machine
│ │ └── __init__.py # Marks the directory as a Python package
│ ├── machine.py # Module for cse machine
│ └── __init__.py # Marks the directory as a Python package
├── .vscode/ # Directory for VS Code settings
│ └── settings.json # VS Code settings file
|
├── interpreter/ # Package for interpreter functionality
│ ├── execution_engine.py # Module containing interpreter logic
│ └── __init__.py # Marks the directory as a Python package
├── requirements.txt # File containing project dependencies
|
├── error_handling/ # Package for error handling functionality
│ ├── error_handler.py # Module containing error handling logic
│ └── __init__.py # Marks the directory as a Python package
├── Makefile # Makefile for automating tasks such as installation, running tests, and cleaning up
|
├── table_routines/ # Package for table routines functionality
│ ├── char_map.py # Module containing character mapping logic
│ ├── fsa_table.py # Module containing Finite State Automaton table logic
│ ├── accept_states.py # Module containing accept states logic
│ ├── keywords.py # Module containing keywords set
│ └── __init__.py # Marks the directory as a Python package
|
├── utils/ # Package for utility functionalities
│ ├── tokens.py # Module containing token class definition
│ ├── node.py # Module containing node data structure class definition
│ ├── stack.py # Module containing stack class definition
│ ├── token_printer.py # Module containing token printing function (for debugging purposes)
│ ├── tree_printer.py # Module containing tree printing function (for debugging purposes)
│ ├── tree_list.py # Module for listing tree elements
│ ├── file_handler.py # Module containing file handling functions
│ └── __init__.py # Marks the directory as a Python package
|
├── rpal_tests/ # Directory for tests
│ ├── rpal_sources/ # Directory for RPAL source code files to test
│ ├── test_generate_tests.py # Module for generating tests
│ ├── test_generate_ast_tests.py # Module for generating tests in rpal_sources by pytest for AST
│ ├── test_generate_st_tests.py # Module for generating tests in rpal_sources by pytest for standard tree
│ ├── test_generate_tests_with_rpal_exe.py # Module for generating tests in rpal_sources by pytest output generated by real rpal.exe
│ ├── test_generate_ast_tests_with_rpal_exe.py # Module for generating tests in rpal_sources by pytest for AST output generated by real rpal.exe
│ ├── test_generate_st_tests_with_rpal_exe.py # Module for generating tests in rpal_sources by pytest for standard tree output generated by real rpal.exe
│ ├── assert_program .py # Module for checking tests
│ ├── program_name_list.py # List of program names in rpal_sources directory
│ ├── output.py # List of outputs generated by rpal.exe
│ ├── output_ast.py # List of AST outputs generated by rpal.exe
│ ├── output_st.py # List of standard tree outputs generated by rpal.exe
│ ├── rpal.exe # RPAL interpreter
│ ├── cygwin1.dll # Cygwin DLL required for execution (if applicable)
│ └── __init__.py # Marks the directory as a Python package
|
├── doc/ # Directory for documentation files
|
├── .vscode/ # Directory for VS Code settings
│ └── settings.json # VS Code settings file
|
├── requirements.txt # File containing project dependencies
|
├── Makefile # Makefile for automating tasks such as installation, running tests, and cleaning up
|
└── __init__.py # Marks the directory as a Python package
└── __init__.py # Marks the directory as a Python package

```

Expand Down
2 changes: 1 addition & 1 deletion myrpal.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

import sys
import platform
from interpreter.execution_engine import Evaluator
from src.interpreter.execution_engine import Evaluator
from rpal_tests.rpal_exe import rpal_exe

def main():
Expand Down
2 changes: 1 addition & 1 deletion rpal_tests/assert_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import os
from rpal_tests.rpal_exe import rpal_exe
from interpreter.execution_engine import Evaluator
from src.interpreter.execution_engine import Evaluator

def program(source_file_name,flag=None):
# Setup: Obtain original output by running the RPAL program using rpal_exe
Expand Down
Loading

0 comments on commit cd56ff2

Please sign in to comment.