Giter Site home page Giter Site logo

aussieplusplus's People

Contributors

allcontributors[bot] avatar jwfxpr avatar zackradisic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

aussieplusplus's Issues

Numerical improvements

Should we consider bitwise operators? I imagine << and >> will run into parsing issues, but |, &, ^, and ~ should be doable. Alternatively, we could use words for all six. (I have no suggestions for what.)

Why does !0 == !1? They both evaluate to YEAH, NAH! which doesn't make sense to me. Typically, 0 corresponds to one boolean and all other integers to the other. This isn't always completely accurate -- for example, Objective-C does this mod 256 -- but I'd say it's pretty uncontroversial that 0 and 1 should have different boolean values.

Should we have literals for NaN and Infinity? It is possible to get them (0 / 0 and 1 / 0 respectively) but I'd prefer them to have names. They currently print as NaN and inf respectively, so if we give them names then the string conversion has to be updated to match.

The syntax highlighting shows literals like 1e9 as if they're numbers, but they don't work: OI MATE! EXPECTED ; BUT GOT 'e9'. It would be nice to be able to express large or small numbers using scientific notation, or have an exponentation operation (like pow() or **) -- preferably both.

Update Documentation

There doesn't seem to be any documentation on block comments or increment/decrement statements, even though the issues for them were closed.

Contributing

What kind of things do we need to streamline the contribution process? Let me know if I have missed anything:

  • CONTRIBUTING.md -> outlining guidelines and conventions
  • ARCHITECTURE.md -> documenting internals (high-level things like project architecture, language grammar, etc.)
  • All Contributors bot

Importing modules

As well as importing built-in functions with IMPOHT ME FUNC, a keyword for importing user-defined modules should be defined. I suggest OI, or COOEE.

E.g.

IMPOHT ME FUNC ChuckSomeDice;
COOEE utilities.aussie;
IMPOHT ME FUNC HitTheSack;
OI gizzabeerdahl.aussie;

thread 'main' panicked at 'cannot sample empty range'

Apparently ChuckSomeDice really doesn't like non-integers, as this code:

G'DAY MATE!
IMPOHT ME FUNC ChuckSomeDice;
ChuckSomeDice(0, 0.5);
CHEERS C***!

outputs the following error:

thread 'main' panicked at 'cannot sample empty range', /Users/zackradisic/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.8.4/src/rng.rs:134:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Proposal for flexible boolean syntax

Boolean values are currently represented by NAH, YEAH and YEAH, NAH, which are perfectly clear and understandable truth statements that all humans should immediately understand, obviously.

Of course we all know that these are the simplest, most idealised ways to express true and false values. A truly aussie boolean representation will need to be more flexible than this.

I would suggest that, in true aussie fashion, the following values should all resolve to true:

NAH, YEAH
YEAH, NAH, YEAH
NAH, NAH, YEAH, NAH, YEAH
YEAH, YEAH, NAH, NAH, NAH, YEAH

etc. Similar patterns for false statements, obviously.

I'd suggest that , separators between NAH and YEAH tokens should also be optional. I.e., the following should all evaluate to true:

NAH, YEAH
NAH YEAH
NAHYEAH

Block comments

The syntax highlighting suggests /* ... */ comments exist, but using one causes an error.

Add LICENSE

I noticed here that you appear to have chosen an MIT license for the website. It's also wise to add a LICENSE to the repository to disambiguate and clearly document the license in use; people are much more likely to contribute to (or use) projects that have a clear licence that they understand.

GitHub allows for you to do this easily 👍 Alternatively, if the MIT license wasn't an active choice, it's worth considering what license might suit, for example https://choosealicense.com/ and other similar sites might be of help. 😊

Function definitions erase previous definitions

G'DAY MATE!

// declare function `f()`
THE HARD YAKKA FOR f IS () <
    GIMME "No args";
>

// intended to be an overload, ends up being a silent redefinition
THE HARD YAKKA FOR f IS (x) <
    GIMME x;
>

f(); // <- OI MATE, CAN YA FUCKIN' COUNT?? EXPECTED 1 ARGUMENTS BUT GOT 0

CHEERS C***!

That feels like the wrong error for that context. If the language doesn't support overloading, you shouldn't be able to redefine a function with the same name.

Increment/decrement statements

GOOD ON YA as increment statement:

I RECKON x = 0;
GOOD ON YA x;
GIMME x;
// Output is 1

PULL YA HEAD IN as decrement statement:

I RECKON x = 1;
PULL YA HEAD IN x;
GIMME x;
// Output is 0

I would expect these to be pre-inc/decrements, where that's relevant

Arse-backward US date format? Faark!

Urgently needs a fix in the GimmeTime function. The sample program time.aussie:

G'DAY MATE!

IMPOHT ME FUNC GimmeTime;

GIMME "the time in sydney is: " + GimmeTime();

produces

the time in sydney is: 10/30/2021, 12:14:29 AM

If I get a chance this weekend I'll have a look at the source and submit a patch.

Broken Sample code

This example code:

I RECKON x IS A WALKABOUT FROM [0, 100) <
	GIMME x;
>

Fails with the following errors:

OI MATE! EXPECTED to BUT GOT ','
EXPECTED NUMBER, STRING, BOOLEAN, NIL, OR IDENTIFIER BUT GOT ','
OI MATE! EXPECTED ; BUT GOT ')'
EXPECTED NUMBER, STRING, BOOLEAN, NIL, OR IDENTIFIER BUT GOT ')'

Error handling

It is not clear whether BONZA and FAIR DINKUM are reserved words.

Also, whether it's FAIR DINKUM or FAIRDINKUM!

Reflect changes to ./DOCS.md and ./examples/ on https://aussieplusplus.vercel.app/

I'm unfamiliar with vercel (I'm not a web dev at all), but I noticed that updates and corrections that have been made to ./DOCS.md and the contents of ./examples/ are not (yet) reflected on the aussieplusplus.vercel.app landing page. 😊

The contents of DOCS.md should be rendered to the Docs section towards the bottom of the page.

The contents of the examples folder should be populated to the drop-down list for the editing area.

Surely there should be a straightforward way to automate that...?

thread 'main' panicked at 'Unable to resolve var'

Perhaps a mistyped variable name should give a more readable error message than this?

thread 'main' panicked at 'Unable to resolve var: Var { ident: Ident { name: "h", line: 11 }, scope_distance: 4294967295 }', src/resolver.rs:211:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Hitting "Run" a second time without fixing the issue also yields the thread panicked while panicking. error mentioned in #16.

blocky

Surely all loops are "blocky's" or "alley loops"

Hexadecimal constants

The syntax highlighting colors 0x2 the same way it does 012, but the former causes an error.

thread 'main' panicked at 'already borrowed: BorrowMutError'

I had written this program:

G'DAY MATE!

THE HARD YAKKA FOR recursiveFunc IS () <
    GIMME"running...";
    recursiveFunc();
>

recursiveFunc();

CHEERS C***!

Notice the typo -- GIMME" rather than GIMME ". The program failed with a syntax error. However, when I fixed it and ran it again, I got this error:

thread 'main' panicked at 'already borrowed: BorrowMutError', /Users/zackradisic/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/io/stdio.rs:872:20
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

The more I click run, the worse the errors get, saying thread panicked while panicking. aborting. and then thread panicked while processing panic. aborting..

Objects

Thingamejig is an object

Rustle up is the initiator

Buggered is the destructor

Concurrency

Zack, Thanks so much. This is delightful. I had a suggestion.
A built-in "class" should be beer. You can have sizes (jug, pony, middy, pint, schooner, etc), and drinking speed (sip, gulp, scull, etc), type (lager, ale, microbrew) and probably much more.

Then you can have DRINK beer(size, speed, type) as an equivalent to the sleep(T ms) function of other languages.

It occurs to me belatedly that you could use a DRINK UNTIL construct for coroutine synchronization.

Strange pattern-matching error

This program:

G'DAY MATE!

YA RECKON x IS A <
    y ~ BAIL NAH, YEAH!;
    z ~ GIMME z;
>

CHEERS C***!

Gives the expected errors:

[line 5] TOO MANY DEFAULT BRANCHES IN MATCH STATEMENT, YA DAFT BUGGER
[line 6] EXPECTED NUMBER, STRING, BOOLEAN, NIL, OR IDENTIFIER BUT GOT '>'

However, if you change it from z to other:

G'DAY MATE!

YA RECKON x IS A <
    y ~ BAIL NAH, YEAH!;
    other ~ GIMME other;
>

CHEERS C***!

It now gives a much more confusing error message:

[line 8] OI MATE! EXPECTED [Number(420.0), String("any string literal"), True, False, BuggerAll, Ident("any identifier")] BUT GOT 'EOF'

Extra output: `EXpr is: ExprNode ...`

This short program, which should print nothing:

G'DAY MATE!

I RECKON i IS A WALKABOUT FROM [1 TO 7] <
>

CHEERS C***!

Instead prints:

EXpr is: ExprNode { expr: Literal(Number(7.0)), line: 3 }

Io

Crack a tinne (...) returns an open tinnie/file
Swig tinnie to read a line
Sip tinnie to get a character
Wif tinnie to find out where the file Pointer is at

To-do List

General

  • Try/catch (WHATYARECKON<> AAHSHELLBERIGHT <>) and throwing errors (STREWTH <value>) #1
  • Modules and imports/exports #3
  • Data types/structures. We need objects and arrays #13
  • Some form of bundling data / encapsulation (classes or structs, though I prefer the Go/Rust struct way) #13
  • Expand standard lib. filesystem IO, network IO (would love to make an aussie web-server), utilities. #12
  • Make YA RECKONs expressions, see #15

Things to discuss / huge undertakings

  • Type system
  • Concurrency, think the easiest way to implement this is an event loop #2

If you have any ideas for any of the features above, feel free to make an issue so we can discuss about it there

Anonymous Functions

I was messing around with callbacks, and I noticed something interesting:

G'DAY MATE!

IMPOHT ME FUNC HitTheSack;

THE HARD YAKKA FOR performAfter IS (callback, duration) <
    HitTheSack(duration);
    callback();
>

THE HARD YAKKA FOR helloWorld IS () <
    GIMME "Hello, World!";
>

I RECKON duration = 1000;

// What combinations of literal/variable are legal?
performAfter(helloWorld, 1000); // works
performAfter(helloWorld, duration); // works
performAfter(// wait, do function literals/closures even exist?
    1000);

CHEERS C***!

I don't have any ideas for what they would be called, but I'm not even sure words would be necessary -- they tend to be pretty punctuationful. Consider how the NOP lambda is []() { } in C++ and () => {} in JS.

Syntactically, I perfer how Swift and Ruby handle it, where the entire closure body is wrapped in braces (in contrast with the closure syntax in JS, which consists of multiple separate parts).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.