This release is a pre-release and may not be stable for production use.
ox: the ox programming language 🐂
ox is a intepreted, dynamic programming language inspired by Cub (no relation to the 2011 one.) Its syntax borrows heavily from Cub itself and golang.
Since ox keeps most of Cub's semantics, existing Cub code should run in ox without any changes (backward-compatible).
ox is not meant to be a production language: rather as an experiment in implementing a programming language entirely in Python.
Why the name ox?
Because the zodiac animal this year is Ox, and to go along with the animal-themed names.
What it can do:
- Full Cub syntax support (except for
doandrepeat whileloops). - Import modules (you can import math functions using
import math)
What it cannot do:
- Recursive functions (because of Python stack limitations). Maybe it would be a better idea to compile Ox code down into [Scorpion] bytecode and run it in an intepreter instead.
- Struct methods (for now).
Todo
- finish full parser (rewrote using sly)
- code working intepreter
- add module system (puts all functions in global context though)
- add ability to interface Python modules
Examples
// ox is kind of like untyped Swift (which is also what Cub was aiming for).
// Currently, these primitive types are supported:
// Strings (to have double quotes in a string, use single quotes, and vice versa.)
// Of course, UTF-8 is supported.
my_var = "Hello World!"
// Numbers are all floating-point as in Cub.
// Like Python, variables do not have a fixed type, and can be reassigned.
// (The '.0' can be omitted.)
my_var = 42
// Booleans can either be true or false.
// Comparisons will return a boolean.
a_bool = true
is_the_answer_to_life_and_everything = my_var >= 42
// Arrays are analogous to lists.
// To append, use '+='.
an_array = [4, 2, 0]
an_array += 1
// Functions define an operation so you don't have to keep copying and pasting the same section of code.
func pi() {
return 3.141592
}
// Structs are similar to C structs.
// Members are defined inside its context.
struct Point {
x, y
}
// A struct method (shown below) accepts a instance of the struct, plus any other parameter.
// The first arg should be named self, but you can name it something else.
func Point:distance(self) {
return (self.x ^ 2) + (self.y ^ 2)
}
// Like Lua, static methods (on a uninitalised struct) use '.',
// while instance methods (on a initalised struct) use ':'.
// Static methods do not receive the 'self' parameter.
func Point.new_square(length) {
return Point(length, length)
}
point = Point(0, 0)
square_point = Point.new_square(10)
// Structs can inherit members and methods from other structs.
// New members can be defined on top of the inherited struct's definition.
struct RelativePoint(Point) {
cx, cy,
}
func RelativePoint:rel_distance(self) {
return (abs(self.cx - self.x) ^ 2) + (abs(self.cy - self.y) ^ 2)
}
Metadata
Release files for oxlang 0.0.1a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| oxlang-0.0.1a0.tar.gz | 15.7 kB | Without provenance | Details for oxlang-0.0.1a0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| oxlang-0.0.1a0-py3-none-any.whl | Python 3 | none | any | Details for oxlang-0.0.1a0-py3-none-any.whl |
Total release size: 29.5 kB
Release files / oxlang-0.0.1a0.tar.gz
| Download URL | oxlang-0.0.1a0.tar.gz |
|---|---|
| Size | 15.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
342271ab491d61b1b4791dfabce79580049e2617316d7966b6629d2ee7ecf2cb
|
|
BLAKE2b-256 checksum How to use checksums |
75340c404cf64070f31489cb751a0c6927f2814fa498808377c86a49d3ffefb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.25.1
|
Release files / oxlang-0.0.1a0-py3-none-any.whl
| Download URL | oxlang-0.0.1a0-py3-none-any.whl |
|---|---|
| Size | 13.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7fd03a6d666d769b880716716213730f9fd9188a64348d6bfd768f32f328d821
|
|
BLAKE2b-256 checksum How to use checksums |
7e28564f3d323b4154b4dcccf5f2bbbd10a641139871f5fcafcbd88bcbdc0376
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.25.1
|
Security for oxlang 0.0.1a0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.