Skip to content

5cover/psdc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PSDC (WIP)

IUT de Lannion Pseudocode compiler (transpiler).

Tools

VSCode Pseudocode extension

Philosophy

Psdc is a transpiler, designed to automate the painstaking task of rewriting Pseudocode programs to other languages. The goal is, given any (valid or invalid) Pseudocode program to produce an equivalent program in the target language.

Equivalent here means:

  • Equivalence in validity: a valid Pseudocode program must transpile to a valid program in the target language. An invalid program (with compiler errors) could not be valid in the target language coincidentally.
  • Equivalence in behavior: a valid Pseudocode program must exert the expected behavior in the target language. Since Pseudocode programs can't be executed, the expected behavior of a program is determined by reading it.
  • Equivalence in semantics: a Pseudocode program and its transpiled counterpart must be semantically equivalent. This means:
    • using the same identifier names (except where target languages keywords are used)
    • using the same order in declarations (as possible considering the rules of the target language)

The target language code must be ready for human reading and modification, and symmetrical with the input (i.e. it must be easy to see to which part of the input corresponds each part of the output, and vice versa).

Roadmap

Target languages

  • C
  • LLVM
  • C#
  • CimPU
  • Java
  • JavaScript
  • Pascal
  • Perl
  • PHP
  • Python
  • Shell
  • SQL

Language features

Notation: bold → underway

  • Alternatives
  • Loops
    • For
    • While
    • Do..While
    • Repeat..Until
  • Procedures
  • Functions
  • Structures
  • selon
  • Fix syntax error handling
  • Lvalues
  • Constant folding for type checking and division by zero
  • Optional brackets in control structures
  • Benchmarks
  • Formal grammar
  • Brace initialization (see TD14 ex 1)
  • More static analysis
  • finPour keyword (equivalent to fin but only for loops)
  • Escape sequences in string and character literals
  • Case-insensitive boolean operators
  • Modules, #include?
  • Numeroted control stuctures (si1, si2, si3)
  • File handling (low priority)
  • Preprocessor (limitations of the language)
    • ecrireEcran newlines
  • GNU-compliant message formatting
  • CLI (use nuget package)
    • custom header
    • -d, --documentation: none, all, file?
    • Global preprocessor directives
    • Formatting customization
    • documentation date: now, file?
  • Tests
    • Errors
    • Valid code
  • Documentation
    • CLI
    • Language standard
  • Initial release
  • Self-hosting (rewrite in Pseudocode)
  • VSCode tooling
    • Debugger
    • Language server

C output configuration

  • Non-null-terminated-string-proof format strings: width specifier for lengthed strings (usually useless since null-terminated, but could be useful if non null-terminated strings are used)
  • Type mappings
    • réelfloat, double, long double?
    • entiershort, int, long?
    • caractèrechar, tchar_t, wchar_t?
  • Parameter names in prototypes?
  • Doxygen documentation skeleton?
  • i++ or ++i