For Students
- Expected Code Percentage
- C++ Code == 100%
- Selection Criteria
- One pull request to add C++ unit tests to the Mogan repo
- The students must implement highlight facility and at least one parser plugin of programming language by themselves to prove that he can complete the project
Project Info
- Name: Syntax highlighting for programming language
- Mentor: @jingkaimori
- Difficulty: Medium to Extremely hard
Project Description
Highlighting code of programming language is a frequently used feature from TeXmacs users. But currently this feature is not implemented properly.
In this project, we need to implement parsing given code (textual) into Abstract Syntax Tree, and highlight code from AST. Tree-sitter is selected because it is the most commonly used parser library in C/C++, including neoVim. However, tree-sitter library recognize only pre-compiled C function as language definition, packing language definition as shared library is necessary.
Further improvement and new feature can be implemented with generated AST, but these work is not included because of difficulty and workload.
Test case should be provided by student. CICD may be hard to implement, thus manually test should be performed.
Project Notes
- A GUIDE OF SHARED LIB PLUGIN NEEDED
Project
- Provide parser of language as plugin.
- Import parser generated by tree-sitter as c source code.
- Enhance current highlight mechanism, introducing tree-sitter library feature
- Parse given code (textual) into Abstract Syntax Tree
- Highlight code from AST, with or without current
highlight_observer
.
Project Technical Requirements
- xmake, C++
- understanding shared library loading process
- understanding highlight mechanism of TeXmacs, noticeable api:
attach_highlight
highlight_observer
observer_rep::set_highlight
-
language
language::has_highlight
language::highlight
language::get_color