Skip to content

Commit

Permalink
cli_trace
Browse files Browse the repository at this point in the history
  • Loading branch information
maestrow committed May 17, 2021
1 parent 0b1605b commit aa94ff8
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/cli_trace.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import * as fs from "fs";
import { Parser } from './parser'
import { Ast as AST } from './grammar-ast'
import { math1 } from './grammars/math1'
import { ometa1, proj } from './grammars/ometa1'
import { TraceDiscovery } from "./utils/trace-discover";


const input = fs.readFileSync('src/grammars/ometa1.ometa', 'utf-8')

//const p = new Parser(math1, [...'((1+2)-3*3)/4'])
//const r = p.match('expr')

const p = new Parser(ometa1, input as unknown as any[], proj)
const r = p.match('ometa')


console.dir(r, {depth: null})
const disco = new TraceDiscovery(ometa1, input, p.trace.data)
const trace = disco.convert()

//console.dir(trace, {depth: null})
fs.writeFileSync("./dist/trace.json", JSON.stringify(trace, null, 2))

0 comments on commit aa94ff8

Please sign in to comment.