Merge pull request 'develop' (#19) from develop into master
Reviewed-on: #19
This commit is contained in:
commit
44262df885
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@
|
||||
builddir
|
||||
*.kb
|
||||
*.obk
|
||||
!examples/*.obk
|
||||
|
2
examples/multi-fact.obk
Normal file
2
examples/multi-fact.obk
Normal file
@ -0,0 +1,2 @@
|
||||
# this is a comment
|
||||
fact("chris cromer" and "martin" and "Isabella" can "program" and "speak english");
|
19
examples/obelisk.obk
Normal file
19
examples/obelisk.obk
Normal file
@ -0,0 +1,19 @@
|
||||
// an incomplete rule, this one stays false
|
||||
rule("chris" is "happy" if "chris" plays "playstation");
|
||||
|
||||
// a rule that gets inserted as true right away
|
||||
fact("this" is "madness");
|
||||
rule("this" is "sparta" if "this" is "madness");
|
||||
|
||||
// a rule that is inserted as false then updated at a later stage
|
||||
rule("bruce" is "batman" if "the waynes" are "dead");
|
||||
fact("the waynes" are "dead");
|
||||
|
||||
// an action that will be false because the fact doesn't exist, should return ignore
|
||||
action(if "tom" is "dangerous" then "avoid" else "ignore");
|
||||
|
||||
// an action that will be true, should return die
|
||||
action(if "this" is "sparta" then "die" else "live");
|
||||
|
||||
fact("what" is "love");
|
||||
rule("baby" dont "hurt me" if "what" is "love");
|
@ -1,7 +1,7 @@
|
||||
project('obelisk',
|
||||
'c',
|
||||
'cpp',
|
||||
version : '1.0.0',
|
||||
version : '1.0.1',
|
||||
license : 'BSD-3-Clause',
|
||||
default_options : [
|
||||
'warning_level=3',
|
||||
|
@ -56,10 +56,10 @@ int obelisk::Lexer::getToken()
|
||||
|
||||
if (getIdentifier() == "extern")
|
||||
{
|
||||
return kTokenExtern;
|
||||
return Token::kTokenExtern;
|
||||
}
|
||||
|
||||
return kTokenIdentifier;
|
||||
return Token::kTokenIdentifier;
|
||||
}
|
||||
|
||||
if (isdigit(lastChar))
|
||||
|
@ -81,22 +81,26 @@ namespace obelisk
|
||||
*
|
||||
*/
|
||||
kTokenFact = -2,
|
||||
|
||||
/**
|
||||
* @brief A rule which is a relationship between a new fact a
|
||||
* existing fact.
|
||||
*
|
||||
*/
|
||||
kTokenRule = -3,
|
||||
|
||||
/**
|
||||
* @brief An action to take if a fact is true.
|
||||
*
|
||||
*/
|
||||
kTokenAction = -4,
|
||||
|
||||
/**
|
||||
* @brief A definition of a new function.
|
||||
*
|
||||
*/
|
||||
kTokenDef = -5,
|
||||
|
||||
/**
|
||||
* @brief An external function that will be linked to.
|
||||
*
|
||||
@ -108,11 +112,13 @@ namespace obelisk
|
||||
*
|
||||
*/
|
||||
kTokenIdentifier = -7,
|
||||
|
||||
/**
|
||||
* @brief A double floating point value.
|
||||
*
|
||||
*/
|
||||
kTokenNumber = -8,
|
||||
|
||||
/**
|
||||
* @brief A string.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user