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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file deez_py-0.1.6.tar.gz.

File metadata

  • Download URL: deez_py-0.1.6.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.19.0-43-generic

File hashes

Hashes for deez_py-0.1.6.tar.gz
Algorithm Hash digest
SHA256 228566f08af4ed1a175107dfbbf8e40ff9c980192802118a6a4b23ef534617f1
MD5 620f7e045752ea2a59f46c07ac8257fe
BLAKE2b-256 275555c7ca211a88ad6b89dcf345d8bb36ec30255e4cb63cf0aa447b7979d54f

See more details on using hashes here.

File details

Details for the file deez_py-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: deez_py-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.19.0-43-generic

File hashes

Hashes for deez_py-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 dd1eba8ee5c4c9019fb84a55549ad477bc7a6c130a4e2c347083173a582dd069
MD5 c0d3f030680d8fbdb00e8c35a369f42a
BLAKE2b-256 a9f135ef32f9cec89085033b76bb4bcb3f005bd487e5bdf4e54af863d37e7c2b

See more details on using hashes here.

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