文档
语言参考
从编译器注册表生成的语句、属性和端口清单。
这一页直接读取编译器的 authoring contract,不另行维护一份关键字清单。新增或修改 DSL 语句后,参考内容会随构建自动更新。
通用结构
一个文件可以包含一个或多个 scene。每个场景由实体、关系、展示请求和运动请求构成:
scene example {
body A mass=1kg
support O
attach A.top to O
show force
}
标识符区分大小写。字符串使用双引号;物理量写成数值和单位,例如 2kg、30deg、9.8m/s^2。
绳路片段
绳路支持 anchor(id)、around(pulley)、tie(body),以及普通实体或自由端标识符。片段顺序决定绳子的拓扑。
场景与基础实体
support - 语法
support <id> [attributes]- 属性
-
height: lengthwidth: lengthx: lengthy: length - 端口
anchor
surface - 语法
surface <id> [attributes]- 属性
-
height: lengthwidth: lengthx: lengthy: lengthangle: anglefriction: smooth | rough | static | kineticmu: quantitymu_kinetic: quantitymu_static: quantitytype: horizontal | incline
block - 语法
block <id> carries <body> [attributes]- 属性
-
height: lengthwidth: lengthx: lengthy: length - 端口
centertopbottomleftright
body - 语法
body <id> [role] [attributes]- 属性
-
height: lengthwidth: lengthx: lengthy: lengthaxis: identifiercross_section: areaguide: identifierinertia_factor: quantitymass: massmaterial: identifier | stringmotion: identifieron: identifierradius: lengthrole: identifiershape: point | block | solid_sphere | hollow_sphere | solid_cylinder | hooptie: identifiervelocity: speedvelocity_x: speedvelocity_y: speedvolume: volume - 端口
centertopbottomleftrightcontactopposite_contactdownslopeupslope
load - 语法
load <id> [attributes]- 属性
-
height: lengthwidth: lengthx: lengthy: lengthmass: mass - 端口
centertopbottomleftright
disk - 语法
body <id> [role] [attributes]- 属性
-
height: lengthwidth: lengthx: lengthy: lengthaxis: identifiercross_section: areaguide: identifierinertia_factor: quantitymass: massmaterial: identifier | stringmotion: identifieron: identifierradius: lengthrole: identifiershape: point | block | solid_sphere | hollow_sphere | solid_cylinder | hooptie: identifiervelocity: speedvelocity_x: speedvelocity_y: speedvolume: volume - 端口
centertopbottomleftrightcontactopposite_contactdownslopeupslope
力学与约束
pulley - 语法
pulley <id> [fixed to <support> | attached to <body>] [attributes]- 属性
-
height: lengthwidth: lengthx: lengthy: lengthradius: length - 端口
axlerim
pendulum - 语法
pendulum <id> fixed to <support> [attributes]- 属性
-
height: lengthwidth: lengthx: lengthy: lengthangle: anglegravity: accelerationlength: length (必填)mass: mass - 端口
pivotbob
spring - 语法
spring <id> [attributes]- 属性
-
height: lengthwidth: lengthx: lengthy: lengthdisplacement: lengthextension: lengthmodulation_depth: quantitymodulation_frequency: frequencymodulation_phase: anglestiffness: stiffness (必填) - 端口
startend
damper - 语法
damper <id> [attributes]- 属性
-
height: lengthwidth: lengthx: lengthy: lengthcoefficient: damping (必填) - 端口
startend
attach - 语法
attach <from> to <to>- 属性
- 无
pivot - 语法
pivot <body> on <support> [attributes]- 属性
-
position: length
roll - 语法
roll <body> on <surface> <without_slipping|with_slipping>- 属性
-
mode: without_slipping | with_slipping (必填)
orbit - 语法
orbit <body> around <center> [attributes]- 属性
-
direction: clockwise | counterclockwiseeccentricity: quantityobservation_radius: lengthsemi_major_axis: length (必填)start: apoapsis | periapsis
circular-motion - 语法
circular-motion <body> around <center> [attributes]- 属性
-
direction: clockwise | counterclockwiseperiod: timeradius: length (必填)speed: speedstart: angle
launch - 语法
launch <body> from <origin> [attributes]- 属性
-
angle: angle (必填)gravity: accelerationheight: lengthspeed: speed (必填)
impact - 语法
impact <bodyA> with <bodyB> [attributes]- 属性
-
axis: horizontal | contact (必填)restitution: quantity | identifier (必填)
rope - 语法
rope <id> path <segment> -> <segment> [...]- 属性
- 无
- 端口
free
force - 语法
force <id> on <entity-or-port> [attributes]- 属性
-
angle: angledirection: up | down | left | right | up_left | up_right | down_left | down_rightfrequency: frequencymagnitude: forceposition: length
torque - 语法
torque <body> [attributes]- 属性
-
direction: clockwise | counterclockwise (必填)magnitude: torque (必填)
实验装置
rod - 语法
rod <id> [attributes]- 属性
-
length: length (必填)mass: mass - 端口
centerleftright
fiber - 语法
fiber <id> [attributes]- 属性
-
stiffness: stiffness - 端口
topbottom
attract - 语法
attract <source> to <target> [attributes]- 属性
-
law: identifiermagnitude: quantity | identifier
measure - 语法
measure <detector> on <source> [attributes]- 属性
-
observable: identifierreading: quantity | identifier
热学
reservoir - 语法
reservoir <id> [attributes]- 属性
-
energy: quantity | identifiermedium: identifier | stringtemperature: temperature - 端口
inout
heat-engine - 语法
heat-engine <id> [attributes]- 属性
-
efficiency: quantity | identifier - 端口
hotcoldwork
ensemble - 语法
ensemble <id> [attributes]- 属性
-
entropy: quantity | identifiermicrostates: quantity | identifierparticles: quantity | identifier
transfer - 语法
transfer <source> to <target> [attributes]- 属性
-
amount: quantity | identifierform: identifierlabel: identifier | string
cycle - 语法
cycle <engine> between <hot> and <cold> [attributes]- 属性
-
heat_in: energyheat_out: energyschedule: equal_stageswork: energy
场与波
object - 语法
object <id> [attributes]- 属性
-
height: length (必填) - 端口
basetip
lens - 语法
lens <id> [attributes]- 属性
-
type: converging | diverging (必填)focal_length: length (必填) - 端口
centersurface
medium - 语法
medium <id> [attributes]- 属性
-
refractive_index: quantity (必填)
light-source - 语法
light-source <id> [attributes]- 属性
-
color: identifierfrequency: frequency - 端口
emission
prism - 语法
prism <id>- 属性
- 无
- 端口
entryexit
screen - 语法
screen <id>- 属性
- 无
- 端口
surface
detector - 语法
detector <id>- 属性
- 无
- 端口
input
mirror - 语法
mirror <id>- 属性
- 无
- 端口
surface
beam-splitter - 语法
beam-splitter <id>- 属性
- 无
- 端口
inputtransmittedreflected
coil - 语法
coil <id> [attributes]- 属性
-
radius: lengthresistance: resistanceturns: quantity | identifier - 端口
ab
magnet - 语法
magnet <id> [attributes]- 属性
-
dipole_moment: magnetic-dipole-moment - 端口
northsouth
field - 语法
field <id> [attributes]- 属性
-
direction: identifierkind: identifiermagnitude: quantity | identifier
wave - 语法
wave <id> [attributes]- 属性
-
amplitude: quantity | identifierfield: identifierfrequency: frequencyphase: anglespeed: speedwavelength: length - 端口
startend
ray - 语法
ray <source> through <optic> to <target> [attributes]- 属性
-
bend: quantity | identifiercolor: identifier
image - 语法
image <object> through <lens> [attributes]- 属性
-
object_distance: length (必填)
refract - 语法
refract <source> from <incidentMedium> into <transmittedMedium> [attributes]- 属性
-
incidence_angle: angle (必填)
reflect - 语法
reflect <source> from <mirror> [attributes]- 属性
-
incidence_angle: angle (必填)
induction - 语法
induction <coil> by <magnet> [attributes]- 属性
-
axis: axialdistance: lengthmotion: identifier
lorentz - 语法
lorentz <particle> in <field> [attributes]- 属性
-
velocity: right | left | up | down (必填)
velocity-selector - 语法
velocity-selector <particle> through <electricField> and <magneticField> [attributes]- 属性
-
velocity: right | left | up | down (必填)length: length (必填)
propagate - 语法
propagate <wave> from <source> to <target> [attributes]- 属性
-
distance: length
interfere - 语法
interfere <waveA> with <waveB> at <target>- 属性
- 无
电路
battery - 语法
battery <id> [attributes]- 属性
-
height: lengthwidth: lengthx: lengthy: lengthvoltage: voltage (必填) - 端口
positivenegative
ac-source - 语法
ac-source <id> [attributes]- 属性
-
height: lengthwidth: lengthx: lengthy: lengthrms_voltage: voltage (必填)frequency: frequency (必填)phase: angle - 端口
positivenegative
resistor - 语法
resistor <id> [attributes]- 属性
-
height: lengthwidth: lengthx: lengthy: lengthresistance: resistance (必填) - 端口
ab
capacitor - 语法
capacitor <id> [attributes]- 属性
-
height: lengthwidth: lengthx: lengthy: lengthcapacitance: capacitance (必填) - 端口
ab
inductor - 语法
inductor <id> [attributes]- 属性
-
height: lengthwidth: lengthx: lengthy: lengthinductance: inductance (必填) - 端口
ab
wire - 语法
wire <from> to <to>- 属性
- 无
静电学
charge - 语法
charge <id> [attributes]- 属性
-
height: lengthwidth: lengthx: lengthy: lengthvalue: charge (必填)role: source | test
electric-field - 语法
electric-field <field> from <source>- 属性
- 无
流体
fluid - 语法
fluid <id> [attributes]- 属性
-
height: lengthwidth: lengthx: lengthy: lengthdensity: density (必填)gravity: acceleration - 端口
surface
float - 语法
float <body> in <fluid>- 属性
- 无
近现代物理
particle - 语法
particle <id> [attributes]- 属性
-
charge: chargeenergy: energyfrequency: frequencymass: massmomentum: quantity | identifierspeed: speedspin: quantity | identifierwavelength: length - 端口
trajectory
atom - 语法
atom <id> [attributes]- 属性
-
element: identifier | stringmodel: identifier - 端口
center
nucleus - 语法
nucleus <id> [attributes]- 属性
-
isotope: identifier | stringneutrons: quantity | identifierprotons: quantity | identifier - 端口
center
energy-level - 语法
energy-level <id> [attributes]- 属性
-
energy: quantity | identifier (必填)n: quantity | identifier - 端口
state
wavefunction - 语法
wavefunction <id> [attributes]- 属性
-
energy: quantity | identifiermomentum-spread: quantity | identifierposition-spread: quantity | identifierstate: identifier - 端口
state
aperture - 语法
aperture <id> [attributes]- 属性
-
kind: identifierspacing: quantity | identifier - 端口
entryexit
sample - 语法
sample <id> [attributes]- 属性
-
activity: quantity | identifiermaterial: identifier | string - 端口
emission
reactor - 语法
reactor <id> [attributes]- 属性
-
multiplication: quantity | identifiermoderator: identifier - 端口
corecontrol
reference-frame - 语法
reference-frame <id> [attributes]- 属性
-
velocity: quantity | identifier - 端口
origin
event - 语法
event <id> [attributes]- 属性
-
position: quantity | identifiertime: quantity | identifier - 端口
point
transition - 语法
transition <particle> from <from> to <to> [attributes]- 属性
-
photon: quantity | identifier
occupy - 语法
occupy <particle> in <level>- 属性
- 无
describe - 语法
describe <particle> by <state>- 属性
- 无
diffract - 语法
diffract <particle> through <aperture> to <detector>- 属性
- 无
scatter - 语法
scatter <projectile> by <target> to <detector> [attributes]- 属性
-
angle: quantity | identifier
photoelectric-effect - 语法
photoelectric-effect <photon> on <material> releases <electron> [attributes]- 属性
-
angle: angleworkfunction: energy (必填)
signal - 语法
signal <signal> from <from> to <to> in <frame>- 属性
- 无
antiparticle - 语法
antiparticle <antiparticle> of <particle>- 属性
- 无
decay - 语法
decay <parent> to <daughter> emits <emission>- 属性
- 无
collision - 语法
collision <projectile> with <target> produces <product>- 属性
- 无
fission - 语法
fission <parent> by <projectile> into <fragmentA> and <fragmentB> [attributes]- 属性
-
energy: quantity | identifierneutrons: quantity | identifier
chain-reaction - 语法
chain-reaction <reactor> from <fuel> [attributes]- 属性
-
generations: quantity | identifier
展示与动画
place - 语法
place <entity-or-port> at x=<0..1> y=<0..1> [variant=compact|standard|wide|print|poster]- 属性
-
x: quantityy: quantityvariant: compact | standard | wide | print | poster至少填写一项: x, y
show - 语法
show <feature> [feature ...]- 属性
- 无
drive - 语法
drive <target> [direction] [attributes]- 属性
-
angle: angleamplitude: lengthplayback: timedisplacement: lengthduration: timeincidence_angle: angleobject_distance: lengthphase: current_flow | decay | emission | flight | flyby | heave | impact | parametric | period | release | rotation | steady_state | transit