Ghabriel / WebInterpreter

A javascript-based web interpreter for custom programming languages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WebInterpreter

A javascript-based web interpreter for custom programming languages.

During syntactic analysis, stores nodes which use the Command pattern to be executed. Values are pushed to a stack so that nodes can retrieve them. Nodes also have access to the symbol table and other utilities.

The interpreter is also cached (using service workers) to provide offline access.

Project structure

  • Lexical specification: grammar/scanner.jisonlex
  • Syntactic/semantic specification: grammar/parser.jison
  • Node types: scripts/core/Actions.ts
  • Symbol definition: scripts/core/Definitions.ts
  • UI customization: scripts/UI.ts, index.html, css/styles.css

The other files, in theory, don't need to be changed at all.

A basic example of how to use this system is implemented.

User interface features

  • Up/down arrows: history navigation
  • Dot (.): equivalent to the up arrow (better usability for mobile devices)
  • Esc: clears the input
  • Enter: submits the input

Dependencies

jQuery and requireJS are also dependencies, but make automatically downloads them.

Usage

  1. Make any changes you want.
  2. make
  3. Open/refresh index.html in your browser.

About

A javascript-based web interpreter for custom programming languages.

License:Apache License 2.0


Languages

Language:JavaScript 69.8%Language:TypeScript 17.4%Language:Makefile 4.0%Language:Yacc 3.9%Language:Lex 2.9%Language:HTML 1.1%Language:CSS 0.8%