Skip to content

A mathematical expression evaluator with PokemonTypes

License

Notifications You must be signed in to change notification settings

daggy1234/PokeType

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PokeType

A simple mathematical expression evaluator that uses Pokemon types to replace symbols.

Syntax

Reference

Symbol Math Equivalent Pokemon Type
🔥 + Fire
🌊 - Water
🪨 * Rock
💨 / Flying
// Electric
☠️ % Poison
> Fighting
🔮 < Psychic
== Normal
👻 != Ghost
🧚 ( Fairy
🌌 ) Dark
❄️() abs() Ice
⛓() log() Steel
🌿 | Grass
🐉 >= Dragon
🏝️ <= Ground
🐛() ^() Bug

Symbols Needed

Ran out of pokemon types, need help representing: >>> <<<

Data Types

  • Numbers
  • Boolean: "true" or "false"

Examples

Basic Arithmetic

Addition:

1 🔥 1

Subtraction:

1 🌊 1

Comparisons/Boolean

Checking if numbers are equal:

1 ✨ 1

Is true >= false:

true 🐉 false

Functions

For Absolute of -2:

❄️🧚-2🌌
❄️(-2)

Interpreter/Compiler

Using the installed python poketype package!

Syntax Checking

Check if PokeType expression is valid

from poketype import PokeType

pt = PokeType()
pt.check_syntax('code')

Interpret

Run code, and print output.

from poketype import PokeType

pt = PokeType()
print(pt.eval('code'))

Compile

Turn PokeType to python code

from poketype import PokeType

pt = PokeType()
print(pt.compile('code')) #Python

Contributions

Open a PR! This is a WIP

[ ] CLI

[ ] API

[ ] More Interpreters

Releases

No releases published

Packages

No packages published

Languages