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

Uploaded Python 3

File details

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

File metadata

  • Download URL: jxlang-0.2.6rc0.tar.gz
  • Upload date:
  • Size: 15.6 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.6rc0.tar.gz
Algorithm Hash digest
SHA256 ef0f6d7287a74fb21b4b3f2b5af4425a6fe804460fbe7362ebeabffcfff9d5b8
MD5 29aa81afc71d9958304fa4cac855da09
BLAKE2b-256 b409ec2159061b139a77912e8365e57294c21b4b34d2166fdb50a4c44362496f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jxlang-0.2.6rc0-py3-none-any.whl
  • Upload date:
  • Size: 16.0 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.6rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 f1ef14a1b897a61ffdd49818f300598c3fc7ea3a85e20f7429f93f03fb691d88
MD5 164b13dccae41d0f636bd3612055d958
BLAKE2b-256 1676f5749a330d62ad2ade1a0503e0e9590052df9268d54b04cbd4165a8be131

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