Skip to content

Example of Language Server Protocol (LSP) server implementation for obvious language as first step

License

Notifications You must be signed in to change notification settings

vain0x/curage-lang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CURAGE-LANG

This project is my study for language server protocol (LSP) server implementation.

Curage-lang itself is tiny, no-interesting language. I am implementing a LSP server for the language. It has some features, such as syntax error reporting, symbol renaming, etc.

Structure

  • lsp: The language server implementation and VSCode extension.
    • src/extension.ts: Entry point of the VSCode extension.
    • src/server.ts: Entry point of the server.

Syntax

Curage-lang's syntax is very simple. The following describes the syntax in PEG-like notation.

expression = int / name

statement = "let" name "be" expression "\n"

program = statement*

Legends:

  • A* means a sequence of A or empty,
  • A+ means a sequence of A at least one,
  • A / B means A or B.

Example:

let x be 1
let y be x

Tags and Features

  • v0.1.0 (diff): Minimum implementation of LSP server
  • v0.2.0 (diff): Sample of error reporting
  • v0.3.0 (diff): Syntactical analysis and syntax error reporting
  • v0.4.0 (diff): Semantic analysis, hit-testing and symbol highlighting
  • v0.5.0 (diff): Symbol renaming

v0.2.0

v0.2.0 Screenshot

v0.3.0

v0.3.0 Screenshot

v0.4.0

v0.4.0 Screenshot

v0.5.0

Renaming symbols don't need screenshot.

    let x be 1

↓ (Rename x to new_x)

    let new_x be 1

Articles

I'm writing a series of articles to explain source codes in this repository. Written in Japanese language.

See also