Compare commits
29 Commits
Author | SHA1 | Date | |
---|---|---|---|
20c9a0c1a5 | |||
42d1ac9bb7 | |||
9869d369c4 | |||
5d8b7af28d
|
|||
efc00f3473 | |||
578c350b7b | |||
f85f8a4637 | |||
7d57800046
|
|||
bdc69ceea7 | |||
5f9af90e80 | |||
4d7ecf8258 | |||
04902214b7
|
|||
0bfd93150f
|
|||
96a5f25e02 | |||
d4c4d3fe75 | |||
33808b4906
|
|||
44262df885 | |||
5db2343b23 | |||
a07b94a228 | |||
7e3cd0af75
|
|||
97a91a0d6d
|
|||
a91bc9b579
|
|||
f2108492b8
|
|||
6a922e7464 | |||
69ce8faad7 | |||
6ba11f1cc9
|
|||
cf9b5a02e1 | |||
60b920bc86 | |||
402862b54a
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@
|
||||
builddir
|
||||
*.kb
|
||||
*.obk
|
||||
!examples/*.obk
|
||||
|
41
README.md
Normal file
41
README.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# Obelisk
|
||||
|
||||
The Obelisk project is a declarative language designed to help with the implementation of Artificial Intelligence using an easy to use logical programming language.
|
||||
|
||||
## Build requirements
|
||||
|
||||
- Meson
|
||||
- Ninja
|
||||
- LLVM 14
|
||||
- sqlite 3
|
||||
- C++ 17
|
||||
- C 17
|
||||
|
||||
## Build
|
||||
|
||||
```
|
||||
meson builddir
|
||||
cd buildir
|
||||
ninja
|
||||
```
|
||||
|
||||
This process will generate the binary "obelisk", a shared library "libobelisk.so", and a static library "libobelisk.a".
|
||||
|
||||
The binary is used to compile and create obelisk knowledge bases and the the libraries can be linked against to consult the Obelisk knowledge base from any software that can link with the libraries.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
ninja install
|
||||
```
|
||||
|
||||
This will install the Obelisk cli and the Obelisk library globally. You can also copy the resulting shared and/or static library to a project to link against and use an Obelisk knowledge base.
|
||||
|
||||
## License
|
||||
|
||||
Obelisk is licensed under the [The 3-Clause BSD License](LICENSE).
|
||||
|
||||
## Authors
|
||||
|
||||
- Christopher Cromer
|
||||
- Martín Araneda
|
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.3',
|
||||
license : 'BSD-3-Clause',
|
||||
default_options : [
|
||||
'warning_level=3',
|
||||
@@ -30,4 +30,5 @@ if docs_enabled
|
||||
endif
|
||||
endif
|
||||
|
||||
subdir('sqlite')
|
||||
subdir('src')
|
||||
|
20
sqlite/meson.build
Normal file
20
sqlite/meson.build
Normal file
@@ -0,0 +1,20 @@
|
||||
sqlite_sources = files(
|
||||
'sqlite3.c'
|
||||
)
|
||||
|
||||
sqlite_include_directories = include_directories(['.'])
|
||||
|
||||
sqlite_args = [
|
||||
'-DSQLITE_OMIT_DESERIALIZE',
|
||||
'-DSQLITE_OMIT_DEPRECATED',
|
||||
'-DSQLITE_OMIT_JSON',
|
||||
'-DSQLITE_OMIT_LOAD_EXTENSION',
|
||||
'-DSQLITE_OMIT_PROGRESS_CALLBACK',
|
||||
'-DSQLITE_DEFAULT_FOREIGN_KEYS=1',
|
||||
'-DSQLITE_DEFAULT_AUTOVACUUM=1',
|
||||
'-DSQLITE_DISABLE_LFS',
|
||||
'-DSQLITE_OMIT_TEMPDB',
|
||||
'-DSQLITE_OMIT_GET_TABLE',
|
||||
'-DSQLITE_OMIT_COMPLETE',
|
||||
'-DSQLITE_OMIT_COMPILEOPTION_DIAGS'
|
||||
]
|
245165
sqlite/sqlite3.c
Normal file
245165
sqlite/sqlite3.c
Normal file
File diff suppressed because it is too large
Load Diff
12970
sqlite/sqlite3.h
Normal file
12970
sqlite/sqlite3.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -56,10 +56,10 @@ int obelisk::Lexer::getToken()
|
||||
|
||||
if (getIdentifier() == "extern")
|
||||
{
|
||||
return kTokenExtern;
|
||||
return Token::kTokenExtern;
|
||||
}
|
||||
|
||||
return kTokenIdentifier;
|
||||
return Token::kTokenIdentifier;
|
||||
}
|
||||
|
||||
if (isdigit(lastChar))
|
||||
|
16
src/lexer.h
16
src/lexer.h
@@ -80,23 +80,27 @@ namespace obelisk
|
||||
* @brief A fact which is a relationship between 2 entities.
|
||||
*
|
||||
*/
|
||||
kTokenFact = -2,
|
||||
kTokenFact = -2,
|
||||
|
||||
/**
|
||||
* @brief A rule which is a relationship between a new fact a
|
||||
* existing fact.
|
||||
*
|
||||
*/
|
||||
kTokenRule = -3,
|
||||
kTokenRule = -3,
|
||||
|
||||
/**
|
||||
* @brief An action to take if a fact is true.
|
||||
*
|
||||
*/
|
||||
kTokenAction = -4,
|
||||
|
||||
/**
|
||||
* @brief A definition of a new function.
|
||||
*
|
||||
*/
|
||||
kTokenDef = -5,
|
||||
kTokenDef = -5,
|
||||
|
||||
/**
|
||||
* @brief An external function that will be linked to.
|
||||
*
|
||||
@@ -108,16 +112,18 @@ namespace obelisk
|
||||
*
|
||||
*/
|
||||
kTokenIdentifier = -7,
|
||||
|
||||
/**
|
||||
* @brief A double floating point value.
|
||||
*
|
||||
*/
|
||||
kTokenNumber = -8,
|
||||
kTokenNumber = -8,
|
||||
|
||||
/**
|
||||
* @brief A string.
|
||||
*
|
||||
*/
|
||||
kTokenString = -9
|
||||
kTokenString = -9
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -250,6 +250,7 @@ void obelisk::KnowledgeBase::checkRule(obelisk::Fact& fact)
|
||||
auto updateFact = rule.getFact();
|
||||
updateFact.setIsTrue(1.0);
|
||||
updateFact.updateIsTrue(dbConnection_);
|
||||
checkRule(updateFact);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -16,14 +16,21 @@ obelisk_lib_sources = files(
|
||||
)
|
||||
|
||||
obelisk_lib_sources += obelisk_model_sources
|
||||
|
||||
sqlite3 = dependency('sqlite3')
|
||||
obelisk_lib_sources += sqlite_sources
|
||||
|
||||
incdirs = include_directories(['.', 'include'])
|
||||
lib = library('obelisk',
|
||||
|
||||
lib = static_library('obelisk',
|
||||
obelisk_lib_sources,
|
||||
c_args : sqlite_args,
|
||||
include_directories: [incdirs, sqlite_include_directories],
|
||||
install : true
|
||||
)
|
||||
|
||||
shared_library('obelisk',
|
||||
obelisk_lib_sources,
|
||||
c_args : sqlite_args,
|
||||
include_directories: incdirs,
|
||||
dependencies : [sqlite3],
|
||||
version : meson.project_version(),
|
||||
soversion : project_version_lib,
|
||||
install : true
|
||||
|
@@ -15,7 +15,7 @@ namespace obelisk
|
||||
*
|
||||
*/
|
||||
std::string usageMessage = R"(Usage: obelisk [OPTION]... [FILE]...
|
||||
Compile the obelisk source FILE(s) into knoweldge base and library.
|
||||
Compile the obelisk source FILE(s) into knowledge base and library.
|
||||
|
||||
Options:
|
||||
-h, --help shows this help/usage message
|
||||
|
Reference in New Issue
Block a user