Hi,

On Sat, Nov 18, 2023 at 3:14 AM stefanos <vim-dev-git...@256bit.org> wrote:

> I'm fascinated by programming languages and I always find myself digging
> deep in their internals to learn how each creator implements specific
> language features they may find interesting.
>
> In case of Vim's scripting language, how do I read the source code to
> familiarize myself with it?
>

For Vim9 script support, you can go through the following source files:

https://github.com/vim/vim/blob/master/src/vim9compile.c
https://github.com/vim/vim/blob/master/src/vim9expr.c
https://github.com/vim/vim/blob/master/src/vim9execute.c
https://github.com/vim/vim/blob/master/src/vim9instr.c
https://github.com/vim/vim/blob/master/src/vim9script.c
https://github.com/vim/vim/blob/master/src/vim9cmds.c
https://github.com/vim/vim/blob/master/src/vim9class.c

For Vim9 def function compilation, you can start with the
compile_def_function() function.
For Vim9 script execution, you can start with the exec_instructions()
function.

With the implementation of vim9script, I can see we have added "primitive"
> types and class objects and I would like to see how they have improve the
> whole performance and / or what type of bytecode or native code they
> generate behind the scenes.
>

Only code in def functions are compiled and converted to bytecode.  You can
use the 'defcompile'
and 'disassemble <def function name>' command  to see the generated
bytecode.  Example:

vim9script

def Foo()
   var i = 10
   i = i + 20
enddef
defcompile
disassemble Foo


> Are there any plans to write in the near future anything like PHP's internals
> book <https://www.phpinternalsbook.com/>?
>
>
> There are currently no plans to write an internal book.

Regards,
Yegappan

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CAAW7x7mf0hONqJiiNQ7RuYKztagsSC2kDQKeDmqGon0hyZ2z2w%40mail.gmail.com.

Raspunde prin e-mail lui