think-lang


Namethink-lang JSON
Version 0.1.9 PyPI version JSON
download
home_pageNone
SummaryThink - A language for learning computational thinking
upload_time2024-12-06 00:22:12
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT License Copyright (c) 2024 Lawrence Wilson Gray Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords education programming computational thinking
VCS
bugtrack_url
requirements ply ipython jupyter pytest pytest-cov tox black isort flake8 mypy pylint sphinx sphinx-rtd-theme sphinx-autodoc-typehints ipdb jupyter-contrib-nbextensions
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Think

Think is an educational programming language designed to teach computational thinking through problem decomposition. It helps users break down complex problems into manageable parts while providing interactive feedback and explanations.

## Features

- **Structured Problem Solving**: Break down problems into objectives, tasks, subtasks, and steps
- **Interactive Execution**: Run your code and see results in real-time
- **Explain Mode**: Get detailed explanations of what each part of your code does
- **Jupyter Integration**: Use ThinkPy directly in Jupyter notebooks
- **Educational Focus**: Learn computational thinking concepts through hands-on coding

## Installation

```bash
# Clone the repository
git clone https://github.com/yourusername/think.git
cd think

# Install the package
pip install -e .
```

## Quick Start

Here's a simple ThinkPy program that calculates student grades:

```python
objective "Calculate student grades"

task "Data Collection":
    step "Get scores":
        scores = [85, 92, 78, 90, 88]

task "Analysis":
    subtask "Calculate Average":
        total = sum(scores)
        avg = total / len(scores)
        return avg
    
    step "Determine Grade":
        final_score = Calculate_Average()
        decide:
            if final_score >= 90 then:
                grade = "A"
            elif final_score >= 80 then:
                grade = "B"
            else:
                grade = "C"

run "Data Collection"
run "Analysis"
```

## Language Structure

### Core Concepts

1. **Objective**: The main goal of your program
   ```python
   objective "Your goal here"
   ```

2. **Task**: Major components of your solution
   ```python
   task "Task Name":
       # steps or subtasks
   ```

3. **Subtask**: Reusable pieces of code
   ```python
   subtask "Subtask Name":
       # statements
       return result
   ```

4. **Step**: Specific actions
   ```python
   step "Step Name":
       # statements
   ```

### Control Flow

1. **Decide (If/Else)**:
   ```python
    decide:
        if condition then:
           # statements
        elif another_condition then:
           # statements
        else:
           # statements
   ```

2. **Loopd**:
   ```python
    for num in numbers:
       # statements
    end
    for index, value in enumerate(items):
        print(index, value)
    end
    for _, value in enumerate(items):
        print(value)
    end
   ```

### Data Types

- Numbers: `42`, `3.14`
- Strings: `"Hello, World!"`
- Lists: `[1, 2, 3, 4, 5]`
- Variables: `score = 85`
- Dictionaries `{'key': 'value'}

## Jupyter Notebook Usage

1. Load the ThinkPy extension:
   ```python
   %load_ext thinkpy.jupyter_magic
   ```

2. Write ThinkPy code in cells:
   ```python
   %%thinkpy --explain
   
   objective "Your program objective"
   # ... rest of your code
   ```

## Built-in Functions

- `sum(list)`: Calculate the sum of a list
- `len(list)`: Get the length of a list
- `print(value)`: Display a value

## Examples

### Temperature Analysis
```python
objective "Analyze temperature data"

task "Data Collection":
    step "Get readings":
        temps = [72, 75, 68, 70, 73]

task "Analysis":
    subtask "Calculate Average":
        total = sum(temps)
        avg = total / len(temps)
        return avg
    
    subtask "Find High":
        max_temp = temps[0]
        for index, value in enumerate(temps):
            decide:
                if temps[index] > max_temp then:
                    max_temp = temps[index]
        end
        return max_temp

run "Data Collection"
run "Analysis"
```

### Grade Calculator
```python
objective "Calculate final grades"

task "Setup":
    step "Initialize data":
        scores = [85, 92, 78]
        weights = [0.3, 0.4, 0.3]

task "Calculate":
    subtask "Weighted Average":
        total = 0
        for index in range(3):
            total = total + (scores[index] * weights[index])
        end
        return total

run "Setup"
run "Calculate"
```

## Development

### Running Tests
```bash
python -m pytest tests/
```

## Contributing

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Acknowledgments

- Thanks to all contributors to this project
- Inspired by Python and educational programming concepts
- Built with PLY (Python Lex-Yacc)

## Support

For support, feature requests, or bug reports:
1. Check the [documentation](https://think.readthedocs.io/)
2. Open an issue on GitHub
3. Contact the maintainers

---

Made with ❤️ for teaching computational thinking

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "think-lang",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "education, programming, computational thinking",
    "author": null,
    "author_email": "Lawrence Wilson Gray <lwgray@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/88/81/0bc0c40a0a420e6c67ebf30d32caf004a3ded0d1be94421be43f094a0bcb/think_lang-0.1.9.tar.gz",
    "platform": null,
    "description": "# Think\n\nThink is an educational programming language designed to teach computational thinking through problem decomposition. It helps users break down complex problems into manageable parts while providing interactive feedback and explanations.\n\n## Features\n\n- **Structured Problem Solving**: Break down problems into objectives, tasks, subtasks, and steps\n- **Interactive Execution**: Run your code and see results in real-time\n- **Explain Mode**: Get detailed explanations of what each part of your code does\n- **Jupyter Integration**: Use ThinkPy directly in Jupyter notebooks\n- **Educational Focus**: Learn computational thinking concepts through hands-on coding\n\n## Installation\n\n```bash\n# Clone the repository\ngit clone https://github.com/yourusername/think.git\ncd think\n\n# Install the package\npip install -e .\n```\n\n## Quick Start\n\nHere's a simple ThinkPy program that calculates student grades:\n\n```python\nobjective \"Calculate student grades\"\n\ntask \"Data Collection\":\n    step \"Get scores\":\n        scores = [85, 92, 78, 90, 88]\n\ntask \"Analysis\":\n    subtask \"Calculate Average\":\n        total = sum(scores)\n        avg = total / len(scores)\n        return avg\n    \n    step \"Determine Grade\":\n        final_score = Calculate_Average()\n        decide:\n            if final_score >= 90 then:\n                grade = \"A\"\n            elif final_score >= 80 then:\n                grade = \"B\"\n            else:\n                grade = \"C\"\n\nrun \"Data Collection\"\nrun \"Analysis\"\n```\n\n## Language Structure\n\n### Core Concepts\n\n1. **Objective**: The main goal of your program\n   ```python\n   objective \"Your goal here\"\n   ```\n\n2. **Task**: Major components of your solution\n   ```python\n   task \"Task Name\":\n       # steps or subtasks\n   ```\n\n3. **Subtask**: Reusable pieces of code\n   ```python\n   subtask \"Subtask Name\":\n       # statements\n       return result\n   ```\n\n4. **Step**: Specific actions\n   ```python\n   step \"Step Name\":\n       # statements\n   ```\n\n### Control Flow\n\n1. **Decide (If/Else)**:\n   ```python\n    decide:\n        if condition then:\n           # statements\n        elif another_condition then:\n           # statements\n        else:\n           # statements\n   ```\n\n2. **Loopd**:\n   ```python\n    for num in numbers:\n       # statements\n    end\n    for index, value in enumerate(items):\n        print(index, value)\n    end\n    for _, value in enumerate(items):\n        print(value)\n    end\n   ```\n\n### Data Types\n\n- Numbers: `42`, `3.14`\n- Strings: `\"Hello, World!\"`\n- Lists: `[1, 2, 3, 4, 5]`\n- Variables: `score = 85`\n- Dictionaries `{'key': 'value'}\n\n## Jupyter Notebook Usage\n\n1. Load the ThinkPy extension:\n   ```python\n   %load_ext thinkpy.jupyter_magic\n   ```\n\n2. Write ThinkPy code in cells:\n   ```python\n   %%thinkpy --explain\n   \n   objective \"Your program objective\"\n   # ... rest of your code\n   ```\n\n## Built-in Functions\n\n- `sum(list)`: Calculate the sum of a list\n- `len(list)`: Get the length of a list\n- `print(value)`: Display a value\n\n## Examples\n\n### Temperature Analysis\n```python\nobjective \"Analyze temperature data\"\n\ntask \"Data Collection\":\n    step \"Get readings\":\n        temps = [72, 75, 68, 70, 73]\n\ntask \"Analysis\":\n    subtask \"Calculate Average\":\n        total = sum(temps)\n        avg = total / len(temps)\n        return avg\n    \n    subtask \"Find High\":\n        max_temp = temps[0]\n        for index, value in enumerate(temps):\n            decide:\n                if temps[index] > max_temp then:\n                    max_temp = temps[index]\n        end\n        return max_temp\n\nrun \"Data Collection\"\nrun \"Analysis\"\n```\n\n### Grade Calculator\n```python\nobjective \"Calculate final grades\"\n\ntask \"Setup\":\n    step \"Initialize data\":\n        scores = [85, 92, 78]\n        weights = [0.3, 0.4, 0.3]\n\ntask \"Calculate\":\n    subtask \"Weighted Average\":\n        total = 0\n        for index in range(3):\n            total = total + (scores[index] * weights[index])\n        end\n        return total\n\nrun \"Setup\"\nrun \"Calculate\"\n```\n\n## Development\n\n### Running Tests\n```bash\npython -m pytest tests/\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- Thanks to all contributors to this project\n- Inspired by Python and educational programming concepts\n- Built with PLY (Python Lex-Yacc)\n\n## Support\n\nFor support, feature requests, or bug reports:\n1. Check the [documentation](https://think.readthedocs.io/)\n2. Open an issue on GitHub\n3. Contact the maintainers\n\n---\n\nMade with \u2764\ufe0f for teaching computational thinking\n",
    "bugtrack_url": null,
    "license": "MIT License Copyright (c) 2024 Lawrence Wilson Gray Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Think - A language for learning computational thinking",
    "version": "0.1.9",
    "project_urls": {
        "Documentation": "https://think-lang.readthedocs.io/",
        "Homepage": "https://think-lang.org",
        "Issues": "https://github.com/lwgray/think/issues",
        "Repository": "https://github.com/lwgray/think.git"
    },
    "split_keywords": [
        "education",
        " programming",
        " computational thinking"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "953a776b6c72f12dcd761c7146fcb8ad0be198c6547b8cbe91eff0c8a7144c68",
                "md5": "c5e5f501109b7f07ec298eaced59fd88",
                "sha256": "4ef83fb76d01ce77077946038294c7a4ea32222b5dc20b0e0710fa4b03d8cbaa"
            },
            "downloads": -1,
            "filename": "think_lang-0.1.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c5e5f501109b7f07ec298eaced59fd88",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 27113,
            "upload_time": "2024-12-06T00:22:10",
            "upload_time_iso_8601": "2024-12-06T00:22:10.963746Z",
            "url": "https://files.pythonhosted.org/packages/95/3a/776b6c72f12dcd761c7146fcb8ad0be198c6547b8cbe91eff0c8a7144c68/think_lang-0.1.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "88810bc0c40a0a420e6c67ebf30d32caf004a3ded0d1be94421be43f094a0bcb",
                "md5": "51bdabdbcc6255d42c013b926bb5cb24",
                "sha256": "2a0fbb631ff06f9e77648cc56a7d8e33e42d8f2a2dbed5b87387438d5433d8a5"
            },
            "downloads": -1,
            "filename": "think_lang-0.1.9.tar.gz",
            "has_sig": false,
            "md5_digest": "51bdabdbcc6255d42c013b926bb5cb24",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 30662,
            "upload_time": "2024-12-06T00:22:12",
            "upload_time_iso_8601": "2024-12-06T00:22:12.424273Z",
            "url": "https://files.pythonhosted.org/packages/88/81/0bc0c40a0a420e6c67ebf30d32caf004a3ded0d1be94421be43f094a0bcb/think_lang-0.1.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-06 00:22:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lwgray",
    "github_project": "think",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "ply",
            "specs": [
                [
                    ">=",
                    "3.11"
                ]
            ]
        },
        {
            "name": "ipython",
            "specs": [
                [
                    ">=",
                    "7.0.0"
                ]
            ]
        },
        {
            "name": "jupyter",
            "specs": [
                [
                    ">=",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": [
                [
                    ">=",
                    "7.0.0"
                ]
            ]
        },
        {
            "name": "pytest-cov",
            "specs": [
                [
                    ">=",
                    "4.0.0"
                ]
            ]
        },
        {
            "name": "tox",
            "specs": [
                [
                    ">=",
                    "3.24.0"
                ]
            ]
        },
        {
            "name": "black",
            "specs": [
                [
                    ">=",
                    "22.3.0"
                ]
            ]
        },
        {
            "name": "isort",
            "specs": [
                [
                    ">=",
                    "5.10.1"
                ]
            ]
        },
        {
            "name": "flake8",
            "specs": [
                [
                    ">=",
                    "4.0.1"
                ]
            ]
        },
        {
            "name": "mypy",
            "specs": [
                [
                    ">=",
                    "0.950"
                ]
            ]
        },
        {
            "name": "pylint",
            "specs": [
                [
                    ">=",
                    "2.12.0"
                ]
            ]
        },
        {
            "name": "sphinx",
            "specs": [
                [
                    ">=",
                    "4.5.0"
                ]
            ]
        },
        {
            "name": "sphinx-rtd-theme",
            "specs": [
                [
                    ">=",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "sphinx-autodoc-typehints",
            "specs": [
                [
                    ">=",
                    "1.18.0"
                ]
            ]
        },
        {
            "name": "ipdb",
            "specs": [
                [
                    ">=",
                    "0.13.0"
                ]
            ]
        },
        {
            "name": "jupyter-contrib-nbextensions",
            "specs": [
                [
                    ">=",
                    "0.5.1"
                ]
            ]
        }
    ],
    "lcname": "think-lang"
}
        
Elapsed time: 0.48523s