Git Product home page Git Product logo

gizmo-lang's Introduction

Hello!

Thanks for visiting my profile.
โ™ฅ๏ธ My Favorite Things To Do: I love making and learning programming languages.
๐Ÿ“‹ What I'm Working On: I'm currently working on my language Gizmo!
๐Ÿ’ญ What I know: I use C, Python, JavaScript, and Gizmo for my programs.
๐ŸŒฑ What I'm Learning: I'm hoping to learn Rust or Go sometime! I also want to learn how to make fuzzers!

I like contributing to projects too!

Stats

Stats

gizmo-lang's People

Contributors

ellder054 avatar freetink3r avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gizmo-lang's Issues

Division By Zero Error Not Happening

The parser needs to check if the value of the sides is zero while parsing division expressions.
It also needs to be smart enough to know identifier's values. This should report an error.

int a = 5;
int b = 0;
write(a / b);

Calling functions with no arguments gives error

Calling a function with no arguments like this:

int a() {
    return 5;
}
write(a());

results in this error.

error: On line 4
Unexpected token
write(a());
        ^

The cause of this problem is that our parser does not allow expressions to be empty.
The parser expects an expression right after the left parenthesis, but instead finds a right parenthesis. It then throws the error above.

Appending to a list messes up the length of that list.

Take this piece of code:

int[] a = [1, 2, 3];
write(len(a));
write(", ");
append(a, 4);
write(len(a));

It prints:

3, 3

But we add one extra element to the list before we print the length for the second time, so the second number should be 4.

llvm string code generation help needed

When someone make a string and prints it, the write function doesn't know how big the string is. We need to create a list to keep track of the length of each string.
For example:

@.str.1: item 0 in the list
@.str.2: item1 in the list
etc...

AFL counts crashes when it shouldn't

When I run each of the file in the afl-output/crashes directory, they all seem to be working fine. Sometimes I get a gizmo error that says:

error: On line 1
Unexpected character ''
...

LLVM has division troubles

How can LLVM divide two integers and return a double.

  1. div is not an instruction.
  2. sdiv and udiv convert result to integer.
    I want 9 / 18 to return a double 0.500000. Or 10 / 5 to return 2.000000.

Type Checking

When making the expression ast, we need to pass the type of the factor up recursively. If two types don't match, throw an error.

Indexing for expressions

Indexes are defined as "an identifier followed by a left bracket followed by an expression followed by a right bracket".
If we could replace the identifier with an expression, we could support things like this:

var = list[index][index]

or:

var = ("abc" + "def")[0]

Type-specific problem when appending to arrays

Here is a code example that fails, :

string[] a = ["abc"];
append(a, "def");
write(a[1]);

while this doesn't:

int[] a = [1];
append(a, 2);
write(a[1]);

When compiling the first code example and running the llvm, you get a seg-fault.

Problems with %.arr in the generated llvm code

Most statements assume an array is of the type %.arr, but sometimes (with function arguments and storing a %.arr in another %.arr) it gets messed up and says something is a %.arr even when it is a %.arr* (or vice versa).

'Not' operator should work.

The 'not' operator returns the opposite of the given boolean expression. For example, ...

write(not true);

...should output 'false'.

Code generator fails with escaped strings and input

We need an interface to convert between modern gizmo escapes sequences and hex escapes like the ones llvm uses.
We also need to be able to accurately get the correct char length of the strings containing these escapes

[Question] How to contribute?

Hi, I don't have quite experience with LLVM, I'm thinking about contributing here. Also I want to learn how LLVM works, Is it a frame work that you've integrate or is it a toolchain? Any pointers would be helpful. And just wondering what are the ways I could contribute without code?

[Suggestion] Too many commits

Hi, just here to give you a friendly suggestion that apparently you have a lots of tiny commits for every single tiny changes.

Just use git commit --amend to override the last commit with the new changes.

Have a nice day!

Indexes when assigning

Assignments need to be able to support:

list[5] = something

Do to the fact that an assignment is defined as "an identifier followed by the equals sign followed by an expression", this is not allowed.

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.