Coder Social home page Coder Social logo

gryph's People

Contributors

arturcuringa avatar carlosemv avatar vinihcampos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

arturcuringa

gryph's Issues

Scope problem with sub

The following code creates an infinite loop:

sub range(count : int&; end : int; step : int) : [int]{
	l : [int] = [];
	
	while(count < end){
		l = l ++ count; 
		print "eita";
		count = count + 1;
		print "eita2";
	}
	return l;
}

count : int = 0;
range(count,100,1);

Boolean expressions parser

Remarks:

  • Lex is treating all boolean operators as only one: change that!
  • The code will be almost equal to the common expressions parser
    - The relational expression parser is necessary!

Fix subprogram bugs

  • Problem when returning inside a loop
  • Parser for empty parameters call
  • Erroneous call when having optional parameters

sub g(a : int=2; b : int) { print a + b; } g(2);

  • Erroneous call when having named parameters:

sub f(a : int; b : int; c : int) { print a + b; } f(2,c=1,b=2);

++ operation with empty list fails

e.g.

a : [int] = [];
a = a ++ [1];
print(a);

fails with
*** Exception: Type mismatch ++ operator CallStack (from HasCallStack): error, called at src/Execution/Semantic.hs:736:70 in main:Execution.Semantic
while replacing the second line with

a = a ++ 1;

gives
*** Exception: src/Execution/Semantic.hs:(734,46)-(736,103): Non-exhaustive patterns in case

Issue comparing int and float

num : float = 0.0;
while (num < 5) {
	num = num + 1;
	print num;
}
print "done";

Iterates 0 times, printing "done" immediately, while in

num : float = 5.0;
while (num > 0) {
	num = num - 1;
	print num;
}
print "done";

the while never breaks, printing increasingly larger negative numbers.
It is almost, perhaps, as if it considers all floats to be greater than all integers.
Changing the conditions to be
while (num < 5.0)
and
while (num > 0.0)
gives the correct, expected behavior.

Any expression parser

Just put all parsers for expressions together
and substitute the occurrences of "ArithExpr" to a new Expr.

Error c : char = 'a';

c : char = 'a';

Gives :

(line 3, column 12):
unexpected (GTokCharLit "'a'",AlexPn 74 3 12)
expecting GTokPlus, GTokMinus, GTokNot, GTokLParen, GTokLCurly, ident, number, string, GTokTrue, GTokFalse, GTokLSquare, GTokPipe or GTokLess
*** Exception: user error (parse error)

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.