Skip to content

Instantly share code, notes, and snippets.

@disruptek
Forked from haxscramper/languages-and-vms.md
Created October 22, 2020 21:05
Show Gist options
  • Save disruptek/ece900ac618963b34820292f3dbcb5ad to your computer and use it in GitHub Desktop.
Save disruptek/ece900ac618963b34820292f3dbcb5ad to your computer and use it in GitHub Desktop.
languages-and-vms

Language & VM design

Lexing & parsing

Writing own parser

  1. nimly - Lexer Generator and Parser Generator as a Library in Nim.

    With nimly, you can make lexer/parser by writing definition in formats like lex/yacc. nimly generates lexer and parser by using macro in compile-time, so you can use nimly not as external tool of your program but as a library.

  2. npeg - parsing expression grammars in nim

    NPeg is a pure Nim pattern matching library. It provides macros to compile patterns and grammars (PEGs) to Nim procedures which will parse a string and collect selected parts of the input.K

  3. lilt parser generator

    Lilt is a content-free parser generator. It accepts a specification and returns a parser based on that specification. Lilt specifications look very similar to Backus-Naur form, but have extra syntax in order to be a parser generator rather than just a grammar specification.

  4. std/lexbase - This module implements a base object of a lexer with efficient buffer handling.

  5. hparse - Collection of parser utilities for nim - compile/runtime parser generator.

    Collection of various utilities related to parsing, ranging from statically typed wrapper on top of scanf to full parser generator (with support for EBNF notation, tree actions, template rules, compile/runtime parsing and automatic parse tree generation)

  6. std/parseutils

  7. std/strscans

  8. std/pegs

  9. std/strutils

Processing existing languages

  1. treesitter wrappers

    Grammars are available for the following languages:

    • Agda
    • Bash
    • C / C++ / C# / CSS
    • Go
    • Haskell, HTML
    • Java, Javascript
    • OCaml
    • PHP, Python
    • Ruby, Rust
    • Scala
    • Typescript
  2. std/parsesql - sql

  3. hcparse - Higher-level bindings for libclang in nim.

  4. protobuf-nim - Protobuf implementation in pure Nim that leverages the power of the macro system to not depend on any external tools

  5. yaml - NimYAML is a pure YAML implementation for Nim. It is able to read from and write to YAML character streams, and to serialize from and construct to native Nim types. It exclusively supports YAML 1.2.

  6. std/xmlparser, std/parsexml - xml # What is the difference?

  7. std/json - json

  8. std/parsecsv - csv

  9. std/sexp S-expressions parser

VM, JIT

  1. laser/photon_jit - Laser offers its own JIT assembler with features being added on a as needed basis. It is very lightweight and easy to extend.

Examples

Examples of language implementatin in nim.

  1. nim-lang itself - compiler is written entirely in nim
  2. japl - JAPL is an interpreted, dynamically-typed, garbage-collected and minimalistic programming language with C- and Java-like syntax.
  3. arturo - Simple, modern and portable interpreted programming language for efficient scripting
  4. spry - A Smalltalk and Rebol inspired language implemented as an AST interpreter in Nim
  5. make a lisp implementation in nim
  6. lox language implementation
  7. hayago - hayago is a small, fast, embeddable, statically typed scripting language, written in Nim. Its syntax is inspired by Nim itself.
  8. min is a functional, concatenative programming language with a minimalist syntax, a small but practical standard library, and an advanced REPL. All packed in about 1MB*.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment