Skip to content

moonbitlang/parser

Repository files navigation

moonbitlang/parser

Note: This module is highly experimental and unstable. Use with caution.

A parser implementation for the MoonBit programming language, written in MoonBit, providing lexical analysis and syntax parsing capabilities.

This module defines the Abstract Syntax Tree (AST) and provides parsers for MoonBit source code. It includes both a hand-written LL(k) parser with error recovery and an LR(1) parser generated by moonyacc.

Project Structure

src/
├── tokens/            # token definitions and utilities
├── lexer/             # Lexical analysis components
├── mbti_ast/          # AST for .mbti files
├── mbti_parser/       # LR parser for .mbti files
├── syntax/            # AST and utils for MoonBit source code
├── handrolled_parser/ # Hand-written parser implementation
├── yacc_parser/       # LR parser generated by moonyacc
├── test/              # Test suite
└── top.mbt            # parsing entries

Usage

// Parse MoonBit source code from bytes
let source = b"fn hello() -> Unit { println(\"Hello, World!\") }"
let (impls, diagnostics) = @moonbitlang/parser.parse_bytes(source)

Build & Test

This project uses the MoonBit build system:

moon update
moon check
moon test

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •