Skip to content

Wispurr/itzCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

itzCode

A temperorary name for 1141 YZU CS321B Final Proj.

Initial Setup

  1. (Optional) Python Virtual Environment

    • Create venv
    python -m venv .venv
    • Enter Virtual Env

      1. Windows
      .\.venv\Scripts\activate
      1. Linux
      source .\.venv\bin\activate

Usage

  1. From *.itz to *.cpp
  • Using for demostrating specific file

    python .\demo.py <specific features name>
  • Using for demostrating all features

    python .\demo.py --all
  1. From *.cpp to EXEC

    1-1. Windows

    Get-ChildItem .\results\*.cpp | ForEach-Object { g++ -std=c++20 $_.FullName -o ("results\" + $_.BaseName + ".exe") }

    1-2. Linux / Mac

    for f in results/*.cpp; do g++ -std=c++20 "$f" -o "${f%.cpp}"; done

TASKs

  • Define variables

  • Basic arithmetic

  • Condition statements

    • if
    • else
    • then
  • Loop statements

    • for
    • while
  • Print

  • Comments

  • Simple Algorithms

    • max/min
    • max_elements/min_elements
    • sort
  • Input

  • Functions

    • functions
    • struct
    • class
  • STL Containers

    • vectors
    • stack
    • queue
    • link-list
  • File I/O

    • Read File
    • Write File
    • Append File

Project Structure

The following tree illustrates the organization of the project and the purpose of each file.

.
├── demo.py                  # Main Entry Point (Driver Script)
├── build.bat                # (Optional) Windows One-Click Build Script
├── examples/                # Source Code Examples (*.itz)
│   ├── algorithm.itz        # Algorithm implementation (Bubble Sort, Min/Max)
│   ├── comments.itz         # Comment handling tests
│   ├── expressions.itz      # Math operations & type inference tests
│   ├── file.itz             # File I/O tests (Read/Write/Append)
│   ├── function.itz         # Function & Recursion tests
│   ├── hello-world.itz      # Basic String Interpolation
│   ├── input.itz            # User Input (cin) tests
│   ├── logic.itz            # Logic gates & comparison tests
│   ├── loop.itz             # Loops (For/While) tests
│   └── random.itz           # Random number generation tests
├── src/                     # Compiler Core Modules
│   ├── token.py             # Definition of Language Tokens (Enums)
│   ├── lexer.py             # Lexical Analyzer (Raw Text -> Tokens)
│   ├── parser.py            # Syntax Parser (Tokens -> C++ Logic)
│   └── emitter.py           # Code Generator (Manages C++ output buffers)
└── results/                 # Build Artifacts (Generated .cpp & .exe)

FAQ:

0. -bash: /mnt/c/Users/<user>/.pyenv/pyenv-win/shims/python: cannot execute: required file not found

  • Solution:
python3 <rest of the cli commands>

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages