noolsjs / nools

Rete based rules engine written in javascript
http://noolsjs.com/
MIT License
949 stars 181 forks source link

we plan to make a new branch of nools #211

Open taoqf opened 7 years ago

taoqf commented 7 years ago

We have started a new branch of nools nools-ts which is written in Typescript and most of the code come from here. But I have got some problem when building the agenda. Anyone could help me out? Out targe is using nools in modern browsers with less code and less time, maybe we could prebuild the retetree, which i think would save some time in downloading and runtime. @doug-martin @markbjerke

taoqf commented 7 years ago

Could anyone help fix this?

taoqf commented 7 years ago

@DevSide Can you help me out?

DevSide commented 7 years ago

Hi @taoqf, TypeScript is a good choice for nools. Your repo is not a real branch of nools so every commit we make on master will be hard to apply on your project. What is the commit (sha) where you started it from ? I gonna take a look but i'm a beginner in TypeScript :smile:

DevSide commented 7 years ago

I compiled your code using gulp, your test.js seems to work, could you write a test which failed for your problem ?

taoqf commented 7 years ago

test added. @DevSide

DevSide commented 7 years ago

So constraints is always an array because of this line https://github.com/taoqf/nools-ts/blob/d793d40fd6f52a3179aa4e07f26011e429fdcfcd/src/parser/tokens.ts#L46, all tests passes on nools without this block if (!l) { constraints = ["true"]; }. You can remove it from your code

taoqf commented 7 years ago

Thanks @DevSide , I tested nools and removed the code

        // if (!l) {
        //     constraints = ["true"];
        // }

,the exception is gone, but I didn't see the output which i put into `then', and this is not like the behaviour of drools. By the way, I found a InitialFact is asserted into workingmemory, and I guess it is used for this situation, am I right?

taoqf commented 7 years ago

I fixed this. nools-ts

taoqf commented 7 years ago

I've added some tests in the readme, and publish already. and I think noos-ts, can be running just like nools now. try this npm install nools-ts --save

taoqf commented 7 years ago

Any one help to write the grammar? nools-ts grammar.ts

taoqf commented 7 years ago

I have gaven it up. to rewrite the grammar cause I find it is very hard to match then.

foxever commented 7 years ago

@taoqf, maybe you can try to embed a jison ecma grammar parser in then part parsing

taoqf commented 7 years ago

@foxever, right, when I get time, I will try it later.

taoqf commented 7 years ago

nools-ts finished, but I can not explain why it's slower test1 test2 test3 But WHY? I wish it could become faster since i have compiled the rules, any idea? @DevSide @foxever @doug-martin @markbjerke

taoqf commented 7 years ago

I think I have the solution. I changed the rules here. thank you all. I will close this issue now.

taoqf commented 7 years ago

I think maybe someone want to see this.

taoqf commented 7 years ago

Fibonacci