Gazing for Guidance on Using CodeMirror's Custom Syntax Highlighting

Hello to all community members,

I’m now working on a project that requires me to use CodeMirror to build bespoke syntax highlighting for a new programming language. After going through the rudimentary instructions and examples, I still have several questions and would appreciate some advice from the community.

I have the following specific queries:

Tokenization: Which method is better for defining unique tokens specific to my language? Exist any resources or libraries that can help with the development of a CodeMirror-compatible tokenizer?

Mode Configuration: In order to accommodate complex syntax rules or alteryx courses, how should the mode be set up? What are some best practices for organising the mode specification to improve performance and maintainability?

Extending Current Modes: Is it preferable to start from scratch when creating a new mode, or is it feasible to add specific syntax components to an existing mode (like Python or JavaScript)?

Performance Optimization: In order to make sure that my custom mode operates properly, particularly when dealing with big code files, what are some typical mistakes and best practices?

Local Illustrations: Could you offer some code snippets or your experiences working on projects similar to this one if you have any instances of custom syntax highlighting modes?

I would be grateful for any information you could share, links, or case studies. Regards in advance for your assistance!