I rarely look in RaNGE, so my reply here is exceptionally late.
I've made a couple of attempts to implement a scripting language with static typing that would be translated to Lua scripts (which are dynamically typed) fed to LuaJIT VM.
At first, I've made a
parsing library specifically to make sense of the sources. It's based on
Parsing expression grammar concept, though optimized more for building
abstract trees with use of some additional operators and structures.
This time, I've decided to instead implement a
concrete parser directly, to make it a little faster and allow it to skip errors, though on similar basic principles.
There, the distinction between many kinds of tokens, including names and values, is made based on the first symbol. If it's a "letter", the sequence is determined to be a "word", which may be either a "keyword", if it belongs to a specified set, or an "identifier" otherwise. If it's a "digit", then number rules are invoked: the lexer checks if "0x" is present, and depending on that the sequence is interpreted as either a decimal or a hexadecimal number. If it's a quote symbol, the lexer reads a string literal. If it's the equality sign, we check for "==" digraph and yield either equality or assignment operator.
As it's a statically typed language, many decisions are made at compile-time based on the types of the values. For your case, it may be as simple as comparing actual argument types with the function definition, and probably checking if the value being called is indeed a function. I myself plan to have complex types, operator overloading and other
pluses, so I go with a harder way of actual operator resolution.
As the language is intended to be translated to another scripting language, the bytecode produced is probably closer to register-based RISK instructions than to stack-based VM bytecode, and is designed to be very easily converted to Lua, though it shouldn't be very hard to choose another target which supports either multiple-return or pass-by-reference, for example Python. Though I have no idea which one is used by GM.