Skip to content

PyC is a compiled programming language that combines Python-like simplicity with C-style block structure. Designed for ease of learning while maintaining high performance

License

Notifications You must be signed in to change notification settings

Rizal-HID11/PyC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyC

PyC is a compiled programming language that combines Python-like simplicity with C-style block structure. Designed for ease of learning while maintaining high performance

This Language is still at Alpha Version it may not have complete syntax or complete systems.

Current Versions: 0.9.1.2

TODO

Here some Tutorial:

  • To Execute the PyC Code You must type "python src/main.py" in the Terminal it should be give output from files in examples/hello.pyc.

  • To type code the PyC Code You must go to files in examples/hello.pyc then start type code that the syntax specific like PyC or while you execute it will error or not give the right output.

  • To type PyC Code You must go to examples/hello.pyc and start typing PyC Code there

  • To Rename PyC Code Files You must go to files src/main.py and go the last line then you see "compile_and_run("examples/hello.pyc") change hello.pyc to your hello.pyc new name you just change


What's New?

The Difference/New in this Version is:

  • Syntax Issues Fixed: The error in else Syntax of do not want to comparings
  • Comments: Now you can type Messages/Comments in your code with type # Your Comments

What System You Can Make:

I will give a example code for some systems:

Simple Arithmetic Operations:

func main() {
    int x = 12
    int y = 14
    int result = y + x
    print(result)
}

Output: 26

Printings Something:

func main() {
    string Text = "Type Your Text Here"
    print(Text)
}

Output: Type Your Text Here


Example Code

func main() {
    int x = 1
    int y = 2
    int result = x + y
    print(result)
}

Syntax Directory

[
  {"type": "keyword", "value": "func"},
  {"type": "keyword", "value": "return"},
  {"type": "keyword", "value": "print"},
  {"type": "keyword", "value": "if"},
  {"type": "keyword", "value": "else"},
  {"type": "keyword", "value": "while"},
  {"type": "type", "value": "int"},
  {"type": "type", "value": "float"},
  {"type": "type", "value": "string"},
  {"type": "type", "value": "bool"},
  {"type": "symbol", "value": "("},
  {"type": "symbol", "value": ")"},
  {"type": "symbol", "value": "{"},
  {"type": "symbol", "value": "}"},
  {"type": "symbol", "value": "["},
  {"type": "symbol", "value": "]"},
  {"type": "symbol", "value": ";"},
  {"type": "symbol", "value": ","},
  {"type": "symbol", "value": "."},
  {"type": "operator", "value": "="},
  {"type": "operator", "value": "+"},
  {"type": "operator", "value": "-"},
  {"type": "operator", "value": "*"},
  {"type": "operator", "value": "/"},
  {"type": "operator", "value": "=="},
  {"type": "operator", "value": "!="},
  {"type": "operator", "value": ">"},
  {"type": "operator", "value": "<"},
  {"type": "operator", "value": ">="},
  {"type": "operator", "value": "<="},
  {"type": "operator", "value": "!"},
  {"type": "boolean", "value": "true"},
  {"type": "boolean", "value": "false"}
]

Short Explain

Syntax func is To define a function

Syntax print is To print text to the output (print only text not string variabel it won't work)

Syntax int is To define a integer variabel

Syntax if is To define a if a action then what action should do


Project Structure

pyc/
├── src/
│   ├── lexer.py          # Lexical analyzer
│   ├── parser.py         # Syntax parser
│   ├── compiler/         # Bytecode compiler
│   │   └── bytecode.py
│   │   └── semantic.py
│   ├── vm/               # Virtual machine
│   │   └── machine.py
│   ├── helper/               # Helper Functions
│   │   └── token_reader.py
│   └── main.py           # Main compiler driver
├── examples/             # Example PyC programs
│   ├── hello.pyc
└── assets/
    └── lists_tokens.json # Token definitions

Stay tuned for more PyC updates! They're is still growing

About

PyC is a compiled programming language that combines Python-like simplicity with C-style block structure. Designed for ease of learning while maintaining high performance

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages