[![Review Assignment Due Date](https://classroom.github.com/assets/deadline-readme-button-8d59dc4de5201274e310e4c54b9627a8934c3b88527886e3b421487c677d23eb.svg)](https://classroom.github.com/a/fzrjycLm)
[![Open in Codespaces](https://classroom.github.com/assets/launch-codespace-f4981d0f882b2a3f0472912d15f9806d57e124e0fc890972558857b51b24a6f9.svg)](https://classroom.github.com/open-in-codespaces?assignment_repo_id=10589390)
## constant-folding

This is a small library made to fold the constants and similar expressions that
can be folded before runtime. The bulk of the functionalities are bunched up within one function, `constantFolding`, which receives as parameter the code whose constants to fold.

This code goes the extra length with some of the functionalities, despite the author not having time to make the extras in the rubric.

Published in [npm](https://www.npmjs.com/package/@alu0101353647/constant-folding)!

## Installation

```bash
  npm install @alu0101353647/constant-folding
```

## Usage as executable:

Within `input.txt` we have lines of code whose constants to fold. The code will dump the better code at `output.txt`.

```bash
  cf input.txt output.txt
```

## Usage from code:

```javascript
const constantFolding = require('constant-folding');
console.log(constantFolding(`a=[2*2].concat(3, [5,6], [[4]]);`));
```

[The documentation of the function](https://ull-esit-pl-2021.github.io/constant-folding-module-alu0101353647/).

## Examples

See the tests attached in the [repository](https://github.com/ULL-ESIT-PL-2223/constant-folding-juan_guillermo-zafra-alu0101353647/blob/main/test/test.js)

## Author

alu0101353647, the one and only. Also known as Guillermo Zafra.

## Tests

Every test already within the rubric has been added. Additionally, tests with other binary expressions have been added, as well as a complex test.

