jkalend / vut-ifj Goto Github PK
View Code? Open in Web Editor NEWIFJ project - 2022/2023
License: MIT License
IFJ project - 2022/2023
License: MIT License
<?php
declare(strict_types=1);
$i = 0;
while($i < 3) {
if ($i > 0) {
write($z);
} else {}
$z = "Hello, world";
$i = $i + 1;
}
this code doesn't as expected as of now due to the $z variable
<?php declare(strict_types=1);
$a = "a";
$b = 49;
ord(,,,,, $a,, );
chr(,,,,, $b);
write(,,,,"Hello World",,);
strlen(,,,,, "Hello World",,);
According to PHP, this should cause an error, but it does not.
<?php
declare(strict_types=1);
$a = "a";
write(,);
this segfaults
<?php
declare(strict_types=1);
$a = "hello ";
$b = "world";
$c = $a . $b;
output of this should be: hello world
instead it is: helloworld
read functions can return null on bad input, as of now they are considered as return certain types only, not counting null
possible solutions:
As of now there are many pointers that are just handed over and freeing those is a little complicated
putting IDs in one array and so on would make this process much easier
<?php
declare(strict_types=1);
function fun () : void
{
return 0;
?>
<?php
declare(strict_types=1);
return 5;
<?php
declare(strict_types=1);
$a = 10;
function f(int $a) : int {
"halo";
10;
return $a;
}
write(f($a), "\n");
this causes error 2
<?php
declare(strict_types=1);
x;
<?php
declare(strict_types=1);
$x;
as of now, this is being done only by codegen, but here it passes with no issue at all.
we need to implement checking variables and functions at the end of the parser.
<?php
declare(strict_types=1);
return;
// $n and $i are ints
$intval_arg = $n / $i;
$intval = intval($intval_arg);
// $intval is int but $n and $i have floating point values
<?php
declare(strict_types=1);
$a = 5;
function f() : int {
return strlen(chr(0));
}
write(f());
return;
<?php
declare(strict_types=1);
$a = 1;
$b = 1.0;
write(chr($a) === chr($b); // write($a;
this causes error 139
<?php
declare(strict_types=1);
return;
$a = 5;
<?php
declare(strict_types=1);
$a = 49;
$b = 48.0;
function func(int $a, int $b) : string
{
return chr($a) . chr($b);
}
$c = func($a, $b);
write($c);
this should cause an error but as of now it does not
<?php
declare(strict_types=1);
$a = 2;
function a (int $a) : ?int {
if ($a > 2) {
$a = $a + 2;
} else {
$a = $a - 2;
}
return $a;
}
$a = a($a);
?>
can a function and a variable within the same scope share the same identifier?
<?php
declare(strict_types=1);
function f(int $x) : int {
if($x === 0) {
return 0;
} else {
$inp = $x - 1;
$res = g($inp);
return $res + $x;
}
}
function g(int $x) : int {
$res = f($x);
return $res + 1;
}
$res = g(10);
write($res, "\n");
for these examples and variables in while loop we will need some sort of speculative execution.
What is meant by that is:
tests like this:
<?php
declare(strict_types=1);
write($x);
require checking for the definition of a variable in parser, which is currently not being properly done
for each htab we need to check whether their type is D_NONE
or not and in case it is, immediately exit with code 5
also for purposes of memory freeing we can't lose the local htabs, which can, unfortunately, happen as of now.
<?php
declare(strict_types=1);
$i = 0;
while($i === 3) {
if ($i > 0) {
write($i);
} else {}
$z = "Hello, world";
$i = $i + 1;
}
precedential does not accept ===
<?php
declare(strict_types=1);
return 0;
should return 0, instead it causes parser to exit with error code 4
<?php
declare(strict_types=1);
$a = (5 === 5);
write($a);
If the type identifier doesnt have '?' prefix, it cannot contain null value.
As of now, it is allowed and needs to be fixed.
need support for:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.