Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
marihachi committed Aug 19, 2023
1 parent f41f402 commit 2b516ef
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions examples/calculator/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,11 @@ interface Lang {
number: T.Parser<Expr>;
}

const spaces = T.token(/[ \t\r\n]/).many();

const lang = T.language<Lang>({
root: r => T.seq([
spaces,
r.expr,
spaces,
], 1),
root: r => r.expr,

expr: r => {
const atom = T.seq([
spaces,
T.alt([
r.number,
]),
spaces,
], 1);
const atom = r.number;
const pratt = buildPrattParser(atom);
return pratt;
},
Expand Down

0 comments on commit 2b516ef

Please sign in to comment.