Giter Site home page Giter Site logo

dice's People

Contributors

davidwatkins avatar ec2805 avatar khaledatef avatar nethacker11 avatar six5532one avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dice's Issues

support addition of chars and ints

int a = 27;
char b = 93;
result of binop with mixed operand types has type corresponding to the leftmost operand in the expression
char c = b + a;
int a = a + b;

overflow for char addition
char c = b + a + 150;
c; (* 15 *)

Create symbol table for cdecls, fdecls, fields

Parse the ast and retrieve the names of all fields, functions, and classes so they can be used when ensuring the ast is correct. This way the names of the types can be ensured to be defined somewhere.

Convert AST.cdecl to SAST.cdecl

Correctly differentiate the access of functions into structs and functions for LLVM conversion to work correctly; pass class type as first param to all functions

incorrect check for duplicate constructors

this is an incorrect check for duplicate constructors:

let constructorfun = (fun m fdecl -> if (StringMap.mem (get_name fdecl) m) then raise(Exceptions.DuplicateConstructor) else (StringMap.add (get_name fdecl) fdecl m)) in

This code raises a DuplicateConstructor exception:
class Foo {
2 constructor(int a, bool b, char c, float f) {}
3 constructor(int a, bool b, char c) {}
4 }

Cause: this line doesn't concatenate string representations of all the formals in a given constructor:

let params = List.fold_left (fun s -> (function Formal(t, s) -> s ^ "," ^ Utils.string_of_datatype t | _ -> "" )) "" fdecl.formals in

For example, for both constructors in class Foo above, it returns "a,int"

It also fails to raise the exception in this case, even though it should:
class Foo {
2 constructor(int a, bool b, char c, float f) {}
3 constructor(bool b, char c, float f, int a) {}
4 }

To resolve this particular case, we should define an order in which to hash the formals (i.e. all bool formals in alphabetical order by name, then all char formals in alphabetical order by name, then ...)

Do we want to define two constructors as being equal if all formals match on both type AND name, or just on type? In other words, should these two constructors be considered equal?
constructor(int a, bool x)
constructor(int a, bool y)

Parser issue with reading user-defined objects.

File "Compiler_Test_Suite/test-classExtends.dice", line 12, character 7, Syntax Error, token ID(a)

  public float xCoord;
  public float yCoord;
}

class circle extends shape {
  public float radius;
}

class test {
  public void main(char[][] args) {
      circle a = new circle(); 
      a.xCoord = 1.5;
      print(a.xCoord);
  }
}```

I also tried declaring and instantiating on different lines, still didn't work.

float limit

Currently, code such as:
b = 0.0000000000000000000000000000000000000000000001;
is passed by the Scanner as FLOAT_LITERAL(1e-46) which is past our LRM's float limit of 1e-37. Floats as small as 1e-311 and as large as 1e+308 passed through successfully without overflow.

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.