Project: expression-editor
Task (moderate): # Background
Now let's implement the lint capability for the editor

# Target

1. Refactor `parse` in parser.js
  - `parse` should be case-insensitive when encounters operator(e.g. AND, and, And are both valid operators), and should return a Syntax Tree without throwing errors.
  - add operatorRange field for LogicalExpression AST node to save the operator range, type of operatorRange is { from: number; to: number }
  - add `source` field for Program AST node, tracking the original source code.
2. Implement a function named `lint`, and export it in `lint.js` with ESM.

# Constraints

DO NOT modify files other than `parser.js` and `lint.js`.

# Detail of `lint`

`lint` receives Program(return type of `parse`) as input, returns Diagnostic[] as output.

Type definition of Program is

```ts
interface Range {
  from: number;
  to: number;
}

type Program = {
  type: 'Program';
  source: string;
  children: SyntaxNode[];
  range: Range;
}

type Identifier = {
  type: 'Identifier';
  name: string;
  range: Range;
}

type LogicalExpression = {
  type: 'LogicalExpression';
  operator: string;
  operatorRange: Range;
  left: SyntaxNode;
  right: SyntaxNode;
  range: Range;
}

type SyntaxNode = Identifier | LogicalExpression
```

Type definition of Diagnostic is

```ts
type Diagnostic = {
  range: {
    from: number;
    to: number;
  };
  level: 'error' | 'warning';
  message: string;
}
```

## Lint Rules

<rules>
  <rule
    level="error"
    description="AND and OR should be uppercase. All misspells should be reported"
  />
</rules>

## Examples

<examples>
  <example description="No error found">
    <input>foo AND bar</input>
    <diagnostics>
      []
    </diagnostics>
  </example>

  <example description="Find two errors">
    <input>foo and bar or baz</input>
    <diagnostics>
      [
        {
          range: {
            from: 4,
            to: 7,
          },
          level: 'error',
          message: 'Operator should be uppercase. Use AND instead of and.'
        },
        {
          range: {
            from: 12,
            to: 14,
          },
          level: 'error',
          message: 'Operator should be uppercase. Use OR instead of or.'
        }
      ]
    </diagnostics>
  </example>
</examples>