Language::Expr - Simple minilanguage for use in expression
This document describes version 0.29 of Language::Expr (from Perl distribution Language-Expr), released on 2016-07-03.
Language::Expr defines a simple, Perl-like expression minilanguage. It supports mathematical and string operators, arrays, hashes, variables, and functions. See Language::Expr::Manual::Syntax for description of the language syntax.
This distribution consists of the language parser (Language::Expr::Parser), some interpreters (Language::Expr::Interpreter::*), and some compilers (Language::Expr::Compiler::*).
Due to possible bugs in Perl's RE engine or Regexp::Grammars or my grammar, some syntax errors will cause further parsing to fail.
Get compiler named
Get compiler named
I need several compilers and interpreters (some even with different semantics), so it's easier to start with a simple parser of my own. And of course there is personal preference of language syntax.
An interpreter evaluates expression as it is being parsed, while a compiler generates a complete Perl (or whatever) code first. Thus, if you $le->eval() repeatedly using the interpreter mode (setting $le->interpreted(1)), you will repeatedly parse the expression each time. This can be one or more orders of magnitude slower compared to compiling into Perl once and then directly executing the Perl code repeatedly.
Note that if you use $le->eval() using the default compiler mode, you do not reap the benefits of compilation because the expression will be compiled each time you call $le->eval(). To save the compilation result, use $le->compile() or $le->perl() and compile the Perl code yourself using Perl's eval().
Create your own language :-) Fork this distribution and start modifying the Language::Expr::Parser module.
This is a TODO item.
Please visit the project's homepage at https://metacpan.org/release/Language-Expr.
Source repository is at https://github.com/sharyanto/perl-Language-Expr.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Language-Expr
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
Syntax reference: Language::Expr::Manual::Syntax
This software is copyright (c) 2016 by firstname.lastname@example.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.