Skip to main content


Project description


.. image::

.. image::

Americano is a parser and evaluator for a restricted subset of JavaScript, written in Python.

.. code-block:: python

>>> from americano import parse
>>> p = parse('var == 4')
>>> p.eval({'var': 4})
>>> p.eval({'var': 5})

The language accepted is a restricted subset of javascript. The input must be an expression, not a statement.
The following operators are supported:
- ternary operator (?:)
- logical operators (||, &&)
- comparison operators (===, ==, !===, !=, <. <=, >, >=)
- addition/subtraction (+, -)
- multiplication/division (*, /)
- unary logical not (!)
- unary negation/plus (-, +)
- function invocation('(')
- computed member access ('[')

In addition, the following syntax constructs are supported:

- array literal
- null
- true
- false
- single quoted string
- double quoted string
- floating point literal (no exponential notation)
- integer literal

It is implemented using a variation of a Crockford TDOP style Pratt parser modified to support creation of an evaluable node tree on parse.

See these links for algorithm details:


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

americano-0.0.1.tar.gz (5.4 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page