Skip to main content

A custom programming language jxlang

Reason this release was yanked:

正常优化

Project description

JxLang

A lightweight custom programming language designed for simplicity and interactive scripting. Built with Python, jxlang provides a REPL environment and supports basic programming constructs, including variables, loops, functions, and library imports.

Installation

Install jxlang via PyPI:

pip install jxlang

Features

  • Variable Declaration: Use let to declare variables.
  • Loops: for loops with range-based iteration.
  • Functions: Define functions with func and return values using out.
  • I/O Operations: enter() for input, say() for output.
  • Library Imports: Import Python libraries via cite.
  • List/Table Structures: Create lists ([1, 2, 3]) and tables (table(...)).
  • REPL Support: Interactive shell for quick testing.

Quick Examples

1. Variable Declaration and Printing

let x: 5
say(x + 3)  # Output: 8

2. Loop

for (i -> 1 && 5).for(
    say(i)
)
# Output: 1 2 3 4 5

3. Function Definition (Not open for users now)

func(a && b -> add):
    let a: 4
    let b: 5
    out __ + _  # '__'stands for last and last element, 
                # '_'stands for last element

say(add(3, 4))  # Output: 9

* This feature doesn't open for users because it has significant problem we have known. You can wait for next import update that we will have repaired.

4. Input and Output

let name: enter()  # User enters "Alice"
say("Hello, " + name)  # Output: Hello, Alice

5. Import a Python Library

cite math
say(math.sqrt(25))  # Output: 5.0
cite numpy
let a: numpy.array([1,2,3])
say(a)              # Output: [1,2,3]

* JxLang can calls Python Libraries only if you installed in your python environment.

6. List and Table

let lst: table(1, 2, 3)
say(lst[0])  # Output: 1
say(lst)     # Output: [1,2,3]
let tbl = table(1, 2; 3, 4)
say(tbl)     # Output: [[1, 2], [3, 4]]

* JxLang splits into n-plus-1-dimensional lists by n semicolons.

Using the REPL

Start the interactive environment by running:

jxlang

Example REPL session:

jxlang> say(42)
42
jxlang> endend(0)  # you can use numbers from 0 to 9 for endend()
Exiting with code 0

Contributing

Contributions are welcome! Please fork the repository and submit a pull request.
For major changes, open an issue first to discuss your ideas.

License

This project is licensed under the Apache License.


Happy coding! 🚀

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

jxlang-0.2.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jxlang-0.2.0-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file jxlang-0.2.0.tar.gz.

File metadata

  • Download URL: jxlang-0.2.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for jxlang-0.2.0.tar.gz
Algorithm Hash digest
SHA256 93e8ee786de19ae9635828007716a7635a2307357029d965ca7e829d6c0e7eb0
MD5 eceb577a3e5db16d54da49d523f73931
BLAKE2b-256 dd368d927939b697ba185f2229f79e30f79ec8de84375dc2f6c9094f5545cbff

See more details on using hashes here.

File details

Details for the file jxlang-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: jxlang-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for jxlang-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf4c22887d958443097c2fad7f42edea673bd3427b91eba0c744036b798bab3b
MD5 084445923c932eeb21fee802ec0a7186
BLAKE2b-256 410d1e06a573cc54a23918ca11ad7133469109f98aee6cfa26bfdf5e2a3f3577

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page