All Projects → xsawyerx → guacamole

xsawyerx / guacamole

Licence: other
Guacamole is a parser toolkit for Standard Perl. It provides fully static BNF-based parsing capability to a reasonable subset of Perl.

Programming Languages

perl
6916 projects

Projects that are alternatives of or similar to guacamole

dopresskit-static
A static version of Rami Ismail's presskit()
Stars: ✭ 28 (+47.37%)
Mutual labels:  static
subtle-ui
A collection of clever yet understated user interactions found on the web
Stars: ✭ 39 (+105.26%)
Mutual labels:  static
reserve
Lightweight http server statically configurable using regular expressions
Stars: ✭ 19 (+0%)
Mutual labels:  static
crifan.github.io
用于利用github.io去存放crifan的静态页面
Stars: ✭ 32 (+68.42%)
Mutual labels:  static
QtIosCMake
📱 Deploy Qt Application for iOS with a single macro when using CMake.
Stars: ✭ 35 (+84.21%)
Mutual labels:  static
static-string-cpp
Compile-time string manipulation library for modern C++
Stars: ✭ 34 (+78.95%)
Mutual labels:  static
venus
OO Standard Library for Perl 5
Stars: ✭ 14 (-26.32%)
Mutual labels:  perl5
Bullwinkle
An on-the-fly parser for BNF grammars
Stars: ✭ 39 (+105.26%)
Mutual labels:  bnf
lens-jekyll-theme
A Jekyll version of the "Lens" theme by HTML5 UP.
Stars: ✭ 56 (+194.74%)
Mutual labels:  static
astro
Build fast websites, faster. 🚀🧑‍🚀✨
Stars: ✭ 11,024 (+57921.05%)
Mutual labels:  static
Slovo
Искони бѣ Слово - already in production at https://слово.бг
Stars: ✭ 17 (-10.53%)
Mutual labels:  perl5
Devel-hdb
A graphical Perl debugger implemented as a web service
Stars: ✭ 29 (+52.63%)
Mutual labels:  perl5
cocoapods-user-defined-build-types
⚒ A cocoapods plugin that can selectively set build type per pod (static library, dynamic framework, etc.)
Stars: ✭ 91 (+378.95%)
Mutual labels:  static
monopati
a minimalistic static content generator
Stars: ✭ 19 (+0%)
Mutual labels:  static
sphinx-immaterial
Adaptation of the popular mkdocs-material material design theme to the sphinx documentation system
Stars: ✭ 43 (+126.32%)
Mutual labels:  static
hackupc-landing
🚀 HackUPC's landing page
Stars: ✭ 31 (+63.16%)
Mutual labels:  static
Block-Breaker-Original
Arkanoid clone build as part of the Complete Unity C# Developer 2D course (http://gdev.tv/cudgithub)
Stars: ✭ 45 (+136.84%)
Mutual labels:  static
startbootstrap-stylish-portfolio-jekyll
Jekyll theme based on Stylish Portfolio Bootstrap theme
Stars: ✭ 20 (+5.26%)
Mutual labels:  static
aligner
Sublime Text plugin for automatic code alignment.
Stars: ✭ 34 (+78.95%)
Mutual labels:  bnf
dimension-jekyll-theme
A Jekyll version of the "Dimension" theme by HTML5 UP.
Stars: ✭ 29 (+52.63%)
Mutual labels:  static

NAME

Guacamole - A parser toolkit for Standard Perl

VERSION

version 0.007

SYNOPSIS

use Guacamole;
my ($ast) = Guacamole->parse($string);

DESCRIPITON

Guacamole is a Perl parser toolkit.

It can:

  • Parse Standard Perl

    This is explained in this document.

    For Standard Perl, see the next clause.

  • Check a file is written in Standard Perl

    This is done by standard, which is where Standard Perl is described.

  • Lint your code

    See Guacamole::Linter.

  • Deparse your code

    See Guacamole::Deparse.

  • Rewrite your code

    There is a proof-of-concept for this and we hope to provide this as a framework.

Standard Perl

Guacamole only works on Standard Perl. You can read about it here: standard.

Parser

my ($ast) = Guacamole->parse($string);

To parse a string, call Gaucamole's parse method. (This might turn to an object-oriented interface in the future.)

It returns a list of results. If it ever returns more than one, this is a bug that means it couldn't ambiguously parse something. This will later be enforced in the interface. The current interface is not official.

AST Nodes

Guacamole returns an AST with two types of nodes.

my ($ast) = Guacamole->parse('$foo = 1');

The above will generate a larger AST than you imagine (which might be pruned in the future). We'll focus on two types of nodes that will appear above.

Rules

Rules are the top level expressions. They include the definitions for rules. They include information on location in the file, length, line, and column.

$rule = {
    'children'  => [...],
    'column'    => 2,
    'length'    => 3,
    'line'      => 1,
    'name'      => 'VarIdentExpr',
    'start_pos' => 1,
    'type'      => 'rule',
},

This rule is a VarIdentExpr which is an expression for a variable identity.

In the code above, it refers to the foo in $foo - which is the identity itself.

It has one child, described below under Lexemes.

Lexemes

The child for the VarIdentExpr rule should be the value of the identity.

$lexeme = {
    'name'  => '',
    'type'  => 'lexeme',
    'value' => 'foo',
};

The name attribute for all lexemes is empty. This is to make it easy to write code that checks for the value of a rule without having to check whether it's a rule first.

THANKS

  • Damian Conway

    For helping understand what is feasible, what isn't, and why, and for having infinite patience in explaining these.

  • Jeffrey Kegler

    For Marpa and helping understand how to use Marpa better.

  • Gonzalo Diethelm

    For continuous feedback and support.

  • H. Merijn Brand (@Tux)

    For providing the initial production-level test of Guacamole to help shake many of the bugs in the BNF.

SEE ALSO

AUTHORS

  • Sawyer X
  • Vickenty Fesunov

COPYRIGHT AND LICENSE

This software is Copyright (c) 2020 by Sawyer X.

This is free software, licensed under:

The MIT (X11) License
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].