mori0091 / cparsec3 Goto Github PK
View Code? Open in Web Editor NEWCPARSEC3 - a parser-combinator library for C11, 3rd generation.
License: MIT License
CPARSEC3 - a parser-combinator library for C11, 3rd generation.
License: MIT License
Describe the bug
! x
causes "Type mismatch" error in some case even if type of x
was bool
or int
.
To Reproduce
Both of the following code causes "Type mismatch" error:
// case (1)
(|x| !x) 1 ;
// case (2)
(|x| !x) true;
Expected behavior
In case (1), it shall be -2
of type int
.
In case (2), it shall be false
of type bool
.
Development environment (please complete the following information):
Additional context
None.
What's happen? Please describe the problem you met.
The scoping feature was added at #120 ("added 'lexical scope' feature").
But, in fact, it is dynamic scoping because a new scope (block scope) is established in run-time when evaluating a block.
Describe the solution you'd like
Lexical scoping is better for performance and safe/secure programming.
Though needs much work to implement it...
Describe alternatives you've considered
Additional context
Describe the bug
Pug language interpreter causes type error, if a function or a constructor takes two or more arguments of nullary type constructor.
To Reproduce
The below code causes type error:
type Tree
= Leaf int
| Node Tree Tree
;
let t0 = Leaf 0;
let t1 = Leaf 1;
let t2 = Node t0 t1;
also the below code causes type error:
type Nat = Z | S Nat;
var plus : |Nat Nat| Nat;
let plus = |x y| match x {
Z => y;
S n => S (plus n y);
};
let x = plus (S (S Z)) (S Z);
Expected behavior
Both of the above two codes are well formed, and should not cause an error.
Development environment (please complete the following information):
Additional context
(None)
What's happen? Please describe the problem you met.
Parsec(S, None)
is supported in default, but Parsec(S, Maybe(None))
is not.
This causes a problem to implement optional(p)
parser that constructs Parsec(S, Maybe(T))
.
Describe the solution you'd like
Both of the Parsec(S, None)
and Parsec(S, Maybe(None))
are supported in default.
(move None
from PARSER_RETURN_TYPES(S)
to PARSER_RETURN_TYPES_0(S)
)
Describe alternatives you've considered
Additional context
Describe the bug
In case of some recursive functions, wrong value is bound to the function's argument.
To Reproduce
Here is two implementations of factorial function; fact
and fact2
.
fact 4
results 24, it's okay. But fact2 4
results 6 incorrectly.
let fact = |x|
if x <=1 {
1
} else {
x * fact (x - 1)
}
;
let fact2 = |x| f x 1;
let f = |x a|
if x <= 1 {
a
} else {
f (x-1) (x*a) // this is wrongly evaluated as `x = x - 1; a = x * a; f x a`
}
;
Expected behavior
fact2 n
shall be equals to fact n
.
Development environment (please complete the following information):
Additional context
Describe the bug
trait(Ord(Array(T))).cmp(xs, xs)
returns 0, but trait(Ord(Array(T))).cmp(xs, ys)
returns non-zero even if xs
has same contents of ys
.
To Reproduce
Array(char) xs = g_array(char, 'a', 'b', 'c');
Array(char) ys = g_array(char, 'a', 'b', 'c');
assert(g_cmp(xs, xs) == 0); // OK
assert(g_cmp(ys, ys) == 0); // OK
assert(g_cmp(xs, ys) == 0); // assertion fails! (it must be OK)
Expected behavior
In the above case:
g_cmp(xs, ys)
shall be 0
g_le(xs, ys)
shall be true
g_lt(xs, ys)
shall be false
g_ge(xs, ys)
shall be true
g_gt(xs, ys)
shall be false
g_eq(xs, ys)
shall be true
g_neq(xs, ys)
shall be false
Development environment (please complete the following information):
Additional context
None.
Describe the bug
The pug language interpreter results syntax error if the source code starts with white space(s).
To Reproduce
pug -e '1'
result 1
, it's okay.
pug -e ' 1'
causes syntax error.
Expected behavior
Leading white-spaces shall be ignored.
i.e for example pug -e ' 1'
shall results 1
.
Development environment (please complete the following information):
Additional context
nothing.
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.