Skip to main content

A Python implementation of a lexical analyzer that provides comprehensive scanning, and lookahead capabilities. It also implements a parser that comes with awesome functionalities.

Project description

License pypi version

deez_py is a python implementation of a lexical analyzer that provides comprehensive scanning, and lookahead capabilities. It also implements a parser that comes with awesome functionalities.

🛠️ Requirements

deez_py requires Python 3.10 or above.

To install Python 3.10.1, we recommend using pyenv.

# install pyenv
git clone https://github.com/pyenv/pyenv ~/.pyenv

# setup pyenv (you should also put these three lines in .bashrc or similar)
# if you are using zsh
cat << EOF >> ~/.zshrc
# pyenv config
export PATH="${HOME}/.pyenv/bin:${PATH}"
export PYENV_ROOT="${HOME}/.pyenv"
eval "$(pyenv init -)"
EOF

# or if you using the default bash shell, do this instead:
cat << EOF >> ~/.bashrc
# pyenv config
export PATH="${HOME}/.pyenv/bin:${PATH}"
export PYENV_ROOT="${HOME}/.pyenv"
eval "$(pyenv init -)"
EOF
# Close and open a new shell session
# install Python 3.10.1
pyenv install 3.10.1

# make it available globally
pyenv global system 3.10.1

To manage the Python 3.10.1 virtualenv, we recommend using poetry.

# install poetry
curl -sSL https://install.python-poetry.org | python3 -
poetry --version
Poetry \(version 1.5.1\)

# Having the python executable in your PATH, you can use it:
poetry env use 3.10.1

# However, you are most likely to get the following issue:
Creating virtualenv deez_py-dxc671ba-py3.10 in ~/.cache/pypoetry/virtualenvs

ModuleNotFoundError

No module named 'virtualenv.seed.via_app_data'

at <frozen importlib._bootstrap>:973 in _find_and_load_unlocked

# To resolve it, you need to reinstall virtualenv through pip
sudo apt remove --purge python3-virtualenv virtualenv
python3 -m pip install -U virtualenv

# Now, you can just use the minor Python version in this case:
poetry env use 3.10.1
Using virtualenv: ~/.cache/pypoetry/virtualenvs/deez_py-dxc671ba-py3.10

🚨 Installation

With pip:

python3 -m pip install deez-py

🚸 Usage

>>> from deez_py import Lexer
>>> lex = Lexer('=+(){},;')
>>> for _ in range(9):
>>>     print(lex.get_next_token())
...
Token(type=<TokenType.Equal: '='>, literal='=')
Token(type=<TokenType.Plus: '+'>, literal='+')
Token(type=<TokenType.LParen: '('>, literal='(')
Token(type=<TokenType.RParen: ')'>, literal=')')
Token(type=<TokenType.LSquirly: '{'>, literal='{')
Token(type=<TokenType.RSquirly: '}'>, literal='}')
Token(type=<TokenType.Comma: ','>, literal=',')
Token(type=<TokenType.Semicolon: ';'>, literal=';')
Token(type=<TokenType.Eof: 'EOF'>, literal='EOF')

👨‍💻 Development

For local development, you can install all dependencies by running:

make install

🧪 Testing

make test
# or
pytest -vv tests

💡 Tips

To run a subset of tests:

make test
make lint
make coverage

🚀 Deploying

A reminder for maintainers on how to deploy. Run the following commands in order:

bump2version patch # possible: major / minor / patch
git push
git push --tags
make dist
make release

📝 License

Todo.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deez_py-0.1.6.tar.gz (9.6 kB view hashes)

Uploaded Source

Built Distribution

deez_py-0.1.6-py3-none-any.whl (11.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page