Skip to content

Latest commit

 

History

History
52 lines (42 loc) · 2.16 KB

README.md

File metadata and controls

52 lines (42 loc) · 2.16 KB

Experiments with python 3.9 pegen parser for Skulpt

Requirements

Scripts

  • vr build
    • bundles the typescript files into a javascript bundle)
  • vr bundle
    • an alternative to build - uses deno bundle - no minified version
  • vr format
    • runs the precommit hooks for all files
  • vr gen_parser [-v --verbose --verbosity]=1|2
    • generates the javascript parser. Use --verbose|-v|--verbosity to generate a verbose parser.
  • vr gen_asdl
    • generates the javascript astnodes
  • vr gen_ast
    • regenerates the ast for the run-test files from python and dumps the ast in .ast files
  • vr gen_gramar_patch
    • run this after you manually changed the gramar file to store your changes
  • vr apply_gramar_patch
    • run this patch the gramar with the changes stored in the patch
  • vr parse <filename|number> [--nc --no_comapre] [--mode=exec]
    • parses a python file and logs the generated ast vs the python ast
  • vr parse_str <code string> [--nc --no_comapre] [--mode=exec]
    • parses a python file and logs the generated ast vs the python ast
  • vr symtable <filename|number>
    • parses the file and created a symbol table for that ast and prints it
  • vr test <shortname> [-f --fail-fast] [-v]
    • run a test - shortnames: pypeg, parse, dump, symtable

Debugging/Pofiling

See Deno docs on the subject.

# example script execution for inspection use the [--inspect-brk] flag
deno run -A --inspect-brk scripts/parse.ts tmp.txt

Open chrome://inspect and click Inspect below Target:

inspect

  • This will open chrome devtools.
  • The execution of the script will be paused.
  • Run the profiler or add break points to the source and resume the execution (Click pretty-print in source files to display times from profiling)