Skip to main content

A custom programming language jxlang

Reason this release was yanked:

正常优化

Project description

JxLang 0.2.1 -> 0.2.6

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

Update Content

  • Operation of optimization list.
  • Solved the problem of prompting EOF operation error when there is no input line feed.

Features

  • Single-Line Comments: # stands for single-line comments.
  • 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 (table(...)).
  • Exit Session: endend() for exiting current session.
  • REPL Support: Interactive shell for quick testing.

Quick Examples

1. Variable Declaration and Printing

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

2. Loop

(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.6.tar.gz (15.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.6-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jxlang-0.2.6.tar.gz
  • Upload date:
  • Size: 15.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.6.tar.gz
Algorithm Hash digest
SHA256 12efe4ab08412338c08a32bc22d68ae25bebe8d06c55a6b394a0c1ff302282d9
MD5 cc86f40523e443b87d21886ebe1eb570
BLAKE2b-256 4ed1536c267145a2233b6f0e5bf8756d7d38091c0fde9e20f8773fc594ecf586

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jxlang-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 15.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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 9846e904aee2bbba4696935c264d94ac8d8c29167dcde19e1bba4b1f3f80cf40
MD5 cd2a6dd519a2231655c8166b292fba58
BLAKE2b-256 61e48eccd287aef8f2d21e1a2255733bee0f82d21da36acfd4e288d86651c1fa

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