Scan not read
Console program206 lines of .st326 lines of generated Cbuilds as C and Rust
9223372036854775807: 9223372036854775807 (matched 1) 9223372036854775808: 9223372036854775807 (matched 0) -9223372036854775809: 9223372036854775807 (matched 0) hexadecimal: 0 (matched 1) 3.4e38: 339999995214436424907732413799364296704.000000 (matched 1) 3.5e38: 339999995214436424907732413799364296704.000000 (matched 0) 1e-50: 0.000000 (matched 1) -1e-50: -0.000000 (matched 1) inf: -0.000000 (matched 0) nan: -0.000000 (matched 0) 1.8e308: true false (matched 0) 4.9e-324: true false (matched 1) 1 2: 1 2.000000 (matched 2)
On this page
The .st files#
intent.st
structop {
type_app {
exec = {
lang = "C"
}
}
lib_provider {
core = {
source = "StructOp/core"
version = "@latest"
}
}
}main.st
# Language 8.8.6 and 8.8.7: a number that does not fit its kind is not read (the target keeps its value and matched
# counts the targets before it), a decimal too small is read as the nearest value; hexadecimal, inf and nan are no
# numbers. The same in both targets.
ability "value" "i" {
type = Int
initial = 1
}
data "value" "i" {
of = ability.value.i
}
ability "value" "f" {
type = Float
initial = 1.0
}
data "value" "f" {
of = ability.value.f
}
ability "value" "d" {
type = Float64
initial = 1.0
}
data "value" "d" {
of = ability.value.d
}
ability "value" "m" {
type = Int
}
data "value" "m" {
of = ability.value.m
}
ability "scan" "S0" {
source = "9223372036854775807"
pattern = "${ability.value.i}"
matched = ability.value.m
}
ability "print" "P0" {
message = "9223372036854775807: ${data.value.i.current} (matched ${data.value.m.current})"
depends_on = [ability.scan.S0]
}
ability "scan" "S1" {
source = "9223372036854775808"
pattern = "${ability.value.i}"
matched = ability.value.m
depends_on = [ability.print.P0]
}
ability "print" "P1" {
message = "9223372036854775808: ${data.value.i.current} (matched ${data.value.m.current})"
depends_on = [ability.scan.S1]
}
ability "scan" "S2" {
source = "-9223372036854775809"
pattern = "${ability.value.i}"
matched = ability.value.m
depends_on = [ability.print.P1]
}
ability "print" "P2" {
message = "-9223372036854775809: ${data.value.i.current} (matched ${data.value.m.current})"
depends_on = [ability.scan.S2]
}
ability "scan" "S3" {
source = "0x10"
pattern = "${ability.value.i}"
matched = ability.value.m
depends_on = [ability.print.P2]
}
ability "print" "P3" {
message = "hexadecimal: ${data.value.i.current} (matched ${data.value.m.current})"
depends_on = [ability.scan.S3]
}
ability "scan" "S4" {
source = "3.4e38"
pattern = "${ability.value.f}"
matched = ability.value.m
depends_on = [ability.print.P3]
}
ability "print" "P4" {
message = "3.4e38: ${data.value.f.current} (matched ${data.value.m.current})"
depends_on = [ability.scan.S4]
}
ability "scan" "S5" {
source = "3.5e38"
pattern = "${ability.value.f}"
matched = ability.value.m
depends_on = [ability.print.P4]
}
ability "print" "P5" {
message = "3.5e38: ${data.value.f.current} (matched ${data.value.m.current})"
depends_on = [ability.scan.S5]
}
ability "scan" "S6" {
source = "1e-50"
pattern = "${ability.value.f}"
matched = ability.value.m
depends_on = [ability.print.P5]
}
ability "print" "P6" {
message = "1e-50: ${data.value.f.current} (matched ${data.value.m.current})"
depends_on = [ability.scan.S6]
}
ability "scan" "S7" {
source = "-1e-50"
pattern = "${ability.value.f}"
matched = ability.value.m
depends_on = [ability.print.P6]
}
ability "print" "P7" {
message = "-1e-50: ${data.value.f.current} (matched ${data.value.m.current})"
depends_on = [ability.scan.S7]
}
ability "scan" "S8" {
source = "inf"
pattern = "${ability.value.f}"
matched = ability.value.m
depends_on = [ability.print.P7]
}
ability "print" "P8" {
message = "inf: ${data.value.f.current} (matched ${data.value.m.current})"
depends_on = [ability.scan.S8]
}
ability "scan" "S9" {
source = "nan"
pattern = "${ability.value.f}"
matched = ability.value.m
depends_on = [ability.print.P8]
}
ability "print" "P9" {
message = "nan: ${data.value.f.current} (matched ${data.value.m.current})"
depends_on = [ability.scan.S9]
}
ability "scan" "S10" {
source = "1.8e308"
pattern = "${ability.value.d}"
matched = ability.value.m
depends_on = [ability.print.P9]
}
ability "print" "P10" {
message = "1.8e308: ${data.value.d.current > 0.0} ${data.value.d.current == 0.0} (matched ${data.value.m.current})"
depends_on = [ability.scan.S10]
}
ability "scan" "S11" {
source = "4.9e-324"
pattern = "${ability.value.d}"
matched = ability.value.m
depends_on = [ability.print.P10]
}
ability "print" "P11" {
message = "4.9e-324: ${data.value.d.current > 0.0} ${data.value.d.current == 0.0} (matched ${data.value.m.current})"
depends_on = [ability.scan.S11]
}
ability "scan" "S12" {
source = "1 2"
pattern = "${ability.value.i} ${ability.value.f}"
matched = ability.value.m
depends_on = [ability.print.P11]
}
ability "print" "P12" {
message = "1 2: ${data.value.i.current} ${data.value.f.current} (matched ${data.value.m.current})"
depends_on = [ability.scan.S12]
}Input, plan and generated C#
structop plan
structop plan
# program.app will be created
+ program.app (.structop/build/app)
+ ability.value.i
+ ability.value.f
+ ability.value.d
+ ability.value.m
+ ability.scan.S0
+ ability.print.P0
+ ability.scan.S1
+ ability.print.P1
+ ability.scan.S2
+ ability.print.P2
+ ability.scan.S3
+ ability.print.P3
+ ability.scan.S4
+ ability.print.P4
+ ability.scan.S5
+ ability.print.P5
+ ability.scan.S6
+ ability.print.P6
+ ability.scan.S7
+ ability.print.P7
+ ability.scan.S8
+ ability.print.P8
+ ability.scan.S9
+ ability.print.P9
+ ability.scan.S10
+ ability.print.P10
+ ability.scan.S11
+ ability.print.P11
+ ability.scan.S12
+ ability.print.P12
Plan: 1 to add, 0 to change, 0 to destroy.Generated main.c
To inspect this generated file, select C in intent.st, initialize the project and export its source.
Export locally
structop init
structop apply -source -no-runGenerated main.rs (the same .st built as Rust)
To inspect this generated file, select Rust in intent.st, initialize the project and export its source.
Export locally
structop init
structop apply -source -no-runTry it
cd scan-not-read # a folder holding the .st files above
structop init
structop plan
structop apply