Merge branch 'main' of https://github.com/Open-Argon/Chloride
This commit is contained in:
59
README.md
59
README.md
@@ -4,6 +4,61 @@ SPDX-FileCopyrightText: 2025 William Bell
|
|||||||
SPDX-License-Identifier: GPL-3.0-or-later
|
SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
-->
|
-->
|
||||||
|
|
||||||
# Chloride
|
<div align="center">
|
||||||
|
<p>
|
||||||
|
<img width="150" src="logo/logo.png">
|
||||||
|
</p>
|
||||||
|
<h1>Chloride</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
An Argon interpreter written in C
|
Chloride is the new C-based interpreter for the Argon programming language.
|
||||||
|
It is designed as a drop-in replacement for the older Go implementation (argon-v3), while introducing a more efficient runtime and a cleaner, more consistent object model.
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
Chloride aims to remain as interchangeable with argon-v3 as possible.
|
||||||
|
Most existing Argon code should run with minimal or no changes, and backwards compatibility is an ongoing priority.
|
||||||
|
Where behaviour differs, the goal is for those differences to be predictable and well-defined rather than accidental quirks.
|
||||||
|
|
||||||
|
This interpreter replaces argon-v3's AST-walking runtime with a proper bytecode compiler, caching system, and virtual machine.
|
||||||
|
The result is a more consistent execution model, lower memory usage, and improved overall performance, even though speed is not the sole focus of the project.
|
||||||
|
|
||||||
|
## Key Improvements Over argon-v3
|
||||||
|
|
||||||
|
- **Bytecode + VM architecture**
|
||||||
|
Chloride compiles source code into bytecode and executes it through a dedicated virtual machine.
|
||||||
|
The previous interpreter evaluated the AST directly at runtime, which limited performance and made optimisations difficult.
|
||||||
|
|
||||||
|
- **Reduced memory usage and CPU overhead**
|
||||||
|
Chloride is written in C with an emphasis on minimal allocations, predictable lifetimes, and efficient object handling.
|
||||||
|
|
||||||
|
- **Unified object model**
|
||||||
|
In contrast to argon-v3, where some values (such as numbers) were not objects, Chloride treats every value as a first-class object.
|
||||||
|
This simplifies the runtime and ensures a more consistent behaviour across all types.
|
||||||
|
|
||||||
|
- **Proper class and inheritance system**
|
||||||
|
Classes in Chloride are real objects, supporting inheritance and introspection in a clean, well-defined manner.
|
||||||
|
The old interpreter treated classes as a special-case construct, which restricted the language's expressiveness.
|
||||||
|
|
||||||
|
- **Backwards compatibility focus**
|
||||||
|
Chloride aims to match argon-v3’s behaviour closely enough that most existing Argon programs run unchanged.
|
||||||
|
Compatibility fixes and behavioural parity are treated as long-term goals.
|
||||||
|
|
||||||
|
## Project Goals
|
||||||
|
|
||||||
|
- Maintain high compatibility with argon-v3.
|
||||||
|
- Minimise memory usage and improve runtime efficiency.
|
||||||
|
- Provide a stable, maintainable interpreter core.
|
||||||
|
- Keep the implementation straightforward so that future language features can be built cleanly on top of it.
|
||||||
|
- Serve as the reference interpreter for Argon going forward.
|
||||||
|
|
||||||
|
|
||||||
|
## Project Status
|
||||||
|
|
||||||
|
Chloride is still under active development.
|
||||||
|
The object model is largely complete, but several core language features are missing or experimental. Basic control flow constructs such as for loops are not implemented yet, partly because the older syntax was confusing and may be replaced with something clearer. While backwards compatibility is a goal, perfect compatibility is unlikely, especially where new syntax or improved semantics resolve long-standing issues in argon-v3.
|
||||||
|
|
||||||
|
The interpreter currently contains known performance issues and occasional segmentation faults, and part of the development process is identifying and removing these. The intention is to stabilise the runtime, finalise the syntax, and avoid any further major redesigns. The hope is that Chloride becomes both the long-term Argon interpreter and the last large rewrite the language needs.
|
||||||
|
|
||||||
|
# Licence
|
||||||
|
GNU General Public License v3.0
|
||||||
|
|||||||
BIN
logo/logo.png
Normal file
BIN
logo/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
84
logo/logo.svg
Normal file
84
logo/logo.svg
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
width="512"
|
||||||
|
height="512"
|
||||||
|
viewBox="0 0 512 512"
|
||||||
|
version="1.1"
|
||||||
|
id="svg1"
|
||||||
|
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
|
||||||
|
sodipodi:docname="logo.svg"
|
||||||
|
inkscape:export-filename="logo.png"
|
||||||
|
inkscape:export-xdpi="96"
|
||||||
|
inkscape:export-ydpi="96"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="namedview1"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#000000"
|
||||||
|
borderopacity="0.25"
|
||||||
|
inkscape:showpageshadow="2"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:deskcolor="#d1d1d1"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:zoom="1.6199927"
|
||||||
|
inkscape:cx="166.66742"
|
||||||
|
inkscape:cy="208.33427"
|
||||||
|
inkscape:window-width="2560"
|
||||||
|
inkscape:window-height="1414"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="layer1" />
|
||||||
|
<defs
|
||||||
|
id="defs1">
|
||||||
|
<rect
|
||||||
|
x="96.463768"
|
||||||
|
y="150.58824"
|
||||||
|
width="287.20887"
|
||||||
|
height="242.68713"
|
||||||
|
id="rect1" />
|
||||||
|
</defs>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1">
|
||||||
|
<path
|
||||||
|
sodipodi:type="star"
|
||||||
|
style="fill:#555555;fill-opacity:1"
|
||||||
|
id="path7"
|
||||||
|
inkscape:flatsided="false"
|
||||||
|
sodipodi:sides="17"
|
||||||
|
sodipodi:cx="150.15175"
|
||||||
|
sodipodi:cy="58.052856"
|
||||||
|
sodipodi:r1="46.661324"
|
||||||
|
sodipodi:r2="37.32906"
|
||||||
|
sodipodi:arg1="0.30400094"
|
||||||
|
sodipodi:arg2="0.48880051"
|
||||||
|
inkscape:rounded="0.4"
|
||||||
|
inkscape:randomized="2.7755576e-17"
|
||||||
|
d="m 194.67349,72.020461 c -1.44879,4.618019 -9.29136,-0.712277 -11.56404,3.560897 -2.27268,4.273175 6.53108,7.796197 3.5119,11.579008 -3.01918,3.782812 -8.40662,-4.020601 -12.06948,-0.856972 -3.66286,3.163629 3.27373,9.629034 -0.90807,12.065747 -4.18181,2.436719 -6.38654,-6.785922 -10.94489,-5.159103 -4.55835,1.626819 -0.42574,10.161412 -5.2054,10.922942 -4.77966,0.76152 -3.50391,-8.634768 -8.34212,-8.76447 -4.83821,-0.129703 -4.06772,9.32144 -8.79971,8.30493 -4.732,-1.01651 -0.14806,-9.317437 -4.61271,-11.186144 -4.46464,-1.868708 -7.16032,7.222558 -11.20557,4.565293 -4.04525,-2.657264 3.22778,-8.741737 -0.26032,-12.097069 -3.4881,-3.355333 -9.28589,4.148226 -12.09806,0.209088 -2.81217,-3.939138 6.1677,-6.985416 4.12723,-11.374218 -2.04047,-4.388801 -10.15735,0.513654 -11.35664,-4.175355 -1.19929,-4.689009 8.27463,-4.285677 7.95737,-9.115215 -0.31727,-4.829539 -9.65701,-3.190291 -9.08144,-7.995895 0.57556,-4.805603 9.26403,-1.007133 10.71282,-5.625152 1.44879,-4.61802 -7.85242,-6.463369 -5.57974,-10.736544 2.27268,-4.273174 9.00227,2.407431 12.02145,-1.375381 3.01917,-3.782811 -4.98733,-8.863533 -1.32447,-12.027163 3.66286,-3.163629 7.5247,5.496857 11.70651,3.060143 4.18181,-2.436714 -1.44866,-10.066629 3.10969,-11.693447 4.55835,-1.626819 5.03088,7.843901 9.81054,7.082377 4.77966,-0.761525 2.28565,-9.91017 7.12386,-9.780467 4.83821,0.129703 1.85761,9.131584 6.58961,10.148098 4.73199,1.016513 5.71126,-8.415288 10.17591,-6.546581 4.46464,1.868707 -1.56654,9.185997 2.47871,11.843261 4.04525,2.657265 8.36555,-5.783874 11.85365,-2.428541 3.4881,3.355332 -4.77911,7.999788 -1.96695,11.938927 2.81217,3.939138 9.89002,-2.371317 11.93049,2.017485 2.04047,4.388801 -7.34625,5.733164 -6.14696,10.422174 1.19929,4.689009 10.07879,1.3615 10.39605,6.191039 0.31727,4.829538 -8.92123,2.692245 -9.49679,7.497849 -0.57556,4.805603 8.90636,4.910439 7.45757,9.528459 z"
|
||||||
|
inkscape:transform-center-x="1.5847721"
|
||||||
|
inkscape:transform-center-y="-0.51694771"
|
||||||
|
transform="matrix(5.4829104,-0.55336355,0.55336355,5.4829104,-597.77534,21.197933)" />
|
||||||
|
<path
|
||||||
|
style="font-weight:bold;font-size:96px;font-family:'TeX Gyre Heros';-inkscape-font-specification:'TeX Gyre Heros, Bold';white-space:pre;inline-size:117.996;fill:#a9bacd"
|
||||||
|
d="m 231.18969,194.33982 h -14.016 c -0.864,8.928 -6.528,12.96 -15.456,12.96 -11.136,0 -17.664,-8.544 -17.664,-23.808 0,-15.456 6.816,-24.096 18.144,-24.096 7.776,0 12.864,3.552 14.976,12.576 h 13.728 c -1.248,-16.128 -13.44,-24.864 -29.184,-24.864 -19.776,0 -32.064,13.536 -32.064,36.192 0,22.464 12.192,36.096 31.68,36.096 17.376,0 28.992,-9.024 29.856,-25.056 z m 23.42401,23.904 v -69.984 h -13.44 v 69.984 z"
|
||||||
|
id="text2"
|
||||||
|
transform="matrix(4.4012947,0,0,3.7064713,-720.43857,-423.2176)"
|
||||||
|
aria-label="Cl" />
|
||||||
|
<rect
|
||||||
|
style="fill:#a9bacd;fill-opacity:1;stroke-width:0.783784"
|
||||||
|
id="rect4"
|
||||||
|
width="43.448219"
|
||||||
|
height="12.658142"
|
||||||
|
x="421.52911"
|
||||||
|
y="134.00171"
|
||||||
|
sodipodi:insensitive="true" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 4.8 KiB |
@@ -134,8 +134,7 @@ void run_call(ArgonObject *original_object, size_t argc, ArgonObject **argv,
|
|||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
if (CStackFrame) {
|
if (CStackFrame) {
|
||||||
ArgonObject ** registers = ar_alloc(object->value.argon_fn->translated.registerCount *
|
ArgonObject * registers[MAX_REGISTERS]; // fixed on the stack for speed purposes
|
||||||
sizeof(ArgonObject *)); // fixed on the stack for speed purposes
|
|
||||||
StackFrame new_stackFrame = {
|
StackFrame new_stackFrame = {
|
||||||
{object->value.argon_fn->translated.registerCount,
|
{object->value.argon_fn->translated.registerCount,
|
||||||
object->value.argon_fn->translated.registerAssignment,
|
object->value.argon_fn->translated.registerAssignment,
|
||||||
|
|||||||
Reference in New Issue
Block a user