Skip to content

Commit

Permalink
Merge pull request #446 from AAVSO/357-alternative-vela-block-and-sel…
Browse files Browse the repository at this point in the history
…ection-syntax

357 alternative vela block and selection syntax
  • Loading branch information
dbenn authored Jul 27, 2024
2 parents 517e071 + 7910ee7 commit 96619c6
Show file tree
Hide file tree
Showing 9 changed files with 560 additions and 442 deletions.
6 changes: 2 additions & 4 deletions script/VeLa/fact.vl
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/usr/bin/env /Users/david/vstar/script/VeLa/VeLa.sh --verbose
#!/usr/bin/env /Users/david/vstar/script/VeLa/VeLa.sh #--verbose

n!(n:integer) : integer {
when
n <= 0 -> 1
true -> n*n!(n-1)
if n <= 0 then 1 else n*n!(n-1)
}

x <- n!(6)
Expand Down
4 changes: 2 additions & 2 deletions script/VeLa/piecewise_linear_model.vl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ genf() : function {

f(t:real) : real {
-- is time coordinate beyond end of current line segment?
when t > nth(times i+1) and i < length(times)-1 -> {
if t > nth(times i+1) and i < length(times)-1 then {
i <- i+1
}

Expand All @@ -37,7 +37,7 @@ gendf() : function {

df(t:real) : real {
-- is time coordinate beyond end of current line segment?
when t > nth(times i+1) and i < length(times)-1 -> {
if t > nth(times i+1) and i < length(times)-1 then {
i <- i+1
}

Expand Down
12 changes: 6 additions & 6 deletions script/VeLa/velarepl.vl
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ repl() {
while true {
print("==> ")
str <- read()
when
str =~ "^\s*exit\s*$" -> { exit(0) }
true -> {
result <- eval(str)
when length(result) <> 0 -> println(head(result))
}
if str =~ "^\s*exit\s*$" then
exit(0)
else {
result <- eval(str)
if length(result) <> 0 then println(head(result))
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/org/aavso/tools/vstar/vela/AST.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public Type getLiteralType() {
*/
public boolean isDeterministic() {
boolean deterministic = op != Operation.FUNCALL
&& op != Operation.SYMBOL && op != Operation.SELECT;
&& op != Operation.SYMBOL && op != Operation.WHEN;

if (deterministic && !isLeaf()) {
for (AST child : children) {
Expand Down
Loading

0 comments on commit 96619c6

Please sign in to comment.