Skip to content

A simulator for the WHILE programming language

License

Notifications You must be signed in to change notification settings

knowsys/while-simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

While language simulator

Web application for developing and testing WHILE/LOOP programs.

Developed by Simon Meusel and contributors at the research group Knowledge-Based Systems.

Grammar files and parser

  • The WHILE/LOOP language grammar can be found at src/core/parser/nearley/whileGrammar.ne and src/core/parser/nearley/tokens.ts
  • To programmatically parse, analyse and run a WHILE/LOOP program, use the src/core module:
const parser = new NearleyParser();

const programText = 'LOOP x1 DO x0 := x0 + x2 END';
const program = new Program(parser.parseProgramText(programText));

const generator = program.start();

// Simulate the program step by step
for (const configuration of generator) {
    console.log(configuration);
}

How to contribute

  • Docs on how to get the project up and running are in docs/gettingStarted.md.
  • The application structure is described in docs/modules.md
  • Read docs/guidelines.md
  • The application docs should be kept in sync with the source code