Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
226 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env bash | ||
exec ioke -I../lib -Ilib bin/ikrit-p.ik $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
use("akin") | ||
use("akin/parser") | ||
|
||
Akin Parser parseURL( | ||
java:io:File new(System programArguments first) toURL | ||
) code println |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
Akin Semantic = Origin mimic | ||
use("akin/semantic/context") | ||
use("akin/semantic/node") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Akin Semantic Context = Origin mimic | ||
|
||
Akin Semantic do( | ||
|
||
Context initialize = method(@scripts = list) | ||
|
||
Context currentScript = method(scripts last) | ||
|
||
Context analyze = method(chain, | ||
script = create:node(Node Script mimic(self, chain position physical)) | ||
scripts append!(script) | ||
script process(chain) | ||
self | ||
) | ||
|
||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use("akin/semantic") | ||
|
||
Akin Semantic Java = Origin mimic | ||
|
||
let( | ||
Semantic, Akin Semantic, | ||
Node, Akin Semantic Node, | ||
Java, Akin Semantic Java, | ||
|
||
|
||
Java Context = Semantic Context with(Java: Java, Node: Java) | ||
Java Context Context = Java Context | ||
Context = Java Context | ||
|
||
Context create:node = Node cell("create:node") | ||
Context create:ctx = fnx( | ||
ctx = Origin with(Java: Java, Context: Context) | ||
ctx initialize = method(node, @node = node) | ||
ctx | ||
) | ||
) | ||
|
||
use("akin/semantic/java/node") | ||
use("akin/semantic/java/context") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
let( | ||
Semantic, Akin Semantic, | ||
Node, Akin Semantic Node, | ||
Java, Akin Semantic Java, | ||
Context, Akin Semantic Java Context, | ||
|
||
Context initialize = method( | ||
@packages = list(Java Package mimic) | ||
) | ||
Context classes = method(packages map(classes) flatten) | ||
|
||
|
||
Context Script = Context create:ctx | ||
Context Script cell("identifier:package()") = method(msg, receiver, | ||
name = msg body message select(visible?) map(text) join(".") | ||
pkg = node world packages find(p, p name == name) | ||
unless(pkg, | ||
pkg = Java Package mimic(name) | ||
node world packages << pkg | ||
) | ||
list(self, msg afterPunctuation) | ||
) | ||
|
||
Context Script cell("any:identifier") = method(msg, receiver, | ||
pointer = Java Pointer mimic(msg text, msg position physical) | ||
list(self, msg fwd, pointer) | ||
) | ||
|
||
Context Script cell("identifier:class") = method(msg, receiver, | ||
cls = Java Class mimic(nil) | ||
list(self, msg fwd, cls) | ||
) | ||
|
||
Context Script cell("operator:=()") = method(msg, receiver, | ||
lhs = node process(msg body arg(0)) last | ||
rhs = node process(msg body arg(1)) last | ||
|
||
asg = Java Assignment mimic(receiver, lhs, rhs) | ||
|
||
cond( | ||
|
||
asg topLevel? && asg class?, | ||
asg rhs name = lhs name | ||
lhs reference = rhs | ||
rhs package = node currentPackage | ||
node currentPackage classes << rhs, | ||
|
||
true, | ||
error!("ASIGN?") | ||
) | ||
|
||
list(self, msg fwd, asg) | ||
) | ||
|
||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
let( | ||
Java, Akin Semantic Java, | ||
|
||
java:node = fnx(Origin with(Java: Java)) | ||
|
||
Java Script = java:node | ||
Java Script initialize = method(world, position nil, | ||
@world = world | ||
@position = position | ||
@currentPackage = world packages first | ||
) | ||
|
||
Java Package = java:node | ||
Java Package initialize = method(name nil, | ||
@name = name | ||
@classes = list | ||
@interfaces = list | ||
@enums = list | ||
@annotations = list | ||
) | ||
|
||
Java Class = java:node | ||
Java Class initialize = method(name, package nil, | ||
@name = name | ||
@package = package | ||
@inner = Java Package mimic | ||
@annotations = list | ||
@parameters = list | ||
) | ||
|
||
Java Pointer = java:node | ||
Java Pointer initialize = method(name, position nil, reference nil, | ||
@name = name | ||
@position = position | ||
@reference = reference | ||
) | ||
|
||
Java Assignment = java:node | ||
Java Assignment initialize = method(receiver, lhs, rhs, | ||
@receiver = receiver | ||
@lhs = lhs | ||
@rhs = rhs | ||
) | ||
|
||
Java Assignment topLevel? = method(receiver nil?) | ||
Java Assignment class? = method(rhs is?(Java Class)) | ||
|
||
|
||
|
||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
Akin Semantic Node = Origin mimic | ||
|
||
let( | ||
Node, Akin Semantic Node, | ||
|
||
Node create:node = method(object, | ||
object context = Context cell(object kind split last) mimic(object) | ||
object process = Akin Semantic Node cell(:process) | ||
object | ||
) | ||
|
||
|
||
Node process = method(chain, | ||
state = list(context, chain, nil) | ||
while(state && state first && state second, | ||
ctx = state first | ||
msg = state second | ||
receiver = state third | ||
if(msg terminator?, | ||
state = list(context, msg fwd, nil), | ||
if(msg expression?, | ||
orig = "#{msg type}:#{msg text}" | ||
if(msg body, orig += msg body brackets join("")) | ||
name = orig | ||
if(ctx cell?(name), | ||
state = ctx send(name, msg, receiver), | ||
name = "any:#{msg type}" | ||
if(msg body, name += msg body brackets join("")) | ||
if(ctx cell?(name), | ||
state = ctx send(name, msg, receiver), | ||
name = "any:missing" | ||
if(ctx cell?(name), | ||
state = ctx send(name, msg, receiver), | ||
error!("Unknown message #{receiver}##{orig}"+ | ||
" at #{msg position physical} "+ | ||
" on #{ctx}") | ||
) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
|
||
) |