2021-12-07 16:09:17 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-11-23 13:10:03 +01:00
|
|
|
module Rpl
|
2021-12-07 15:50:58 +01:00
|
|
|
module Lang
|
|
|
|
module Core
|
|
|
|
module_function
|
2021-11-18 12:00:02 +01:00
|
|
|
|
2021-12-07 15:50:58 +01:00
|
|
|
# evaluate (run) a program, or recall a variable. ex: 'my_prog' eval
|
|
|
|
def eval( stack, dictionary )
|
2022-02-08 15:45:36 +01:00
|
|
|
stack, args = Rpl::Lang.stack_extract( stack, [:any] )
|
2021-11-18 12:00:02 +01:00
|
|
|
|
2022-02-08 15:45:36 +01:00
|
|
|
Rpl::Lang.eval( stack, dictionary,
|
|
|
|
args[0][:value].to_s )
|
2021-12-07 15:50:58 +01:00
|
|
|
end
|
2021-11-18 12:00:02 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|