Skip to content

beejjorgensen/pl0-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple PL/0 Compiler

This converts PL/0 code to JavaScript via an AST.

The Shunting Yard Algorithm is used for mathematical expressions.

Includes these bits:

  • tokenizer
  • parser
  • emitter (JavaScript)
  • shunting yard

Usage

Right now, the PL/0 source is hardcoded in compiler.js. (Obviously that's scheduled to change.)

node compiler > foo.js
node foo.js

Caveats

This isn't the most efficient code, by any means. The tokenizer and emitter constantly make new strings, for example.

TODO

  • Accept input filename on command line
  • Finish implementing ODD
  • ? statment
  • Report symbol table-related errors
  • Add a C emitter
  • Moar testing!

References

About

A simple PL/0 compiler in JavaScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published