unLomTrois / lexiCK3

Lexical analyzer and parser for CK3 files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What is this?

Golang implementation of linting PDXScript files for Crusader Kings 3

Structure

It is composed of three parts:

  • lexer (tokenizer)
  • parser (LL(1) parser)
  • linter not updated yet

Lexer creates stream of tokens that is consumed by parser, catches lexical errors, like unknown tokens (e.g. you can't write !=)

Parser makes AST (Abstract Syntax Tree), catches syntax errors (e.g. not closed curly brace)

Todo

  • Implement Lexer
  • Add tests on Lexer
  • Implement Parser
  • Update Linter
  • Add tests on Parser
  • Make a VSCode extension

Example of work:

Raw file

image

Linted file:

image

P.S.

If you have zero knowledge in parsing, I recommend watch this playlist first: Building a Parser from scratch

Then you can read first 2-3 chapters of Compilers: Principles, Techniques, and Tools

About

Lexical analyzer and parser for CK3 files

License:MIT License


Languages

Language:Go 99.8%Language:Makefile 0.2%