03 Jul 2016 04:36:51 UTC
- Distribution: Language-Expr
- Module version: 0.29
- Source (raw)
- Browse (raw)
- How to Contribute
- Repository (git clone)
- Issues (1)
- Testers (3790 / 178 / 77)
- KwaliteeBus factor: 1
- 63.22% Coverage
- License: perl_5
- Perl: v5.10.1
- Activity24 month
- Download (35.7KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
- KNOWN BUGS
- Why yet another simplistic (restricted, etc) language? Why not just Perl?
- Why don't you use Language::Farnsworth, or Math::Expression, or Math::Expression::Evaluator, or $FOO?
- What is the difference between a compiler and interpreter?
- I want different syntax for (variables, foo operator, etc)!
- How to show details of errors in expression?
- SEE ALSO
- COPYRIGHT AND LICENSE
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 email@example.com.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Module Install Instructions
To install Language::Expr, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Language::Expr
For more information on module installation, please visit the detailed CPAN module installation guide.