Skip to content

Explore dynamic code analysis in an interpreter for a language that allows on-the-fly customization of syntax rules, small-step operational semantics, and typing. This project facilitates real-time modifications to language interpretation, empowering users to adapt coding experiences according to specific needs.

License

MarcinBrojek/zpo-mgr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

General info

The project was developed as part of a master's thesis. It is a tool that enables designing and using a custom programming language by defining syntax rules, operational semantics in small steps, and typing. Subsequently, code can be written in the invented language. Essentially, this tool is a language interpreter that facilitates what was described above. This happens because we assume a constant structure of the written programs - they consist of individual parts, such as syntax modification. These parts are dynamically analyzed and processed, allowing the created language or its part to be used and tested during development. More information about the project's structure and operation principles can be found in the docs folder.

The project requires further testing and development, so please be aware that there may be bugs in it.

Dependencies & quick set up

The project / interpreter was developed in the Python language and solely relies on Python libraries available at https://pypi.org. Dependencies can be found in the requirements.txt file.

  1. Download repository. (suggested: create virualenv)
  2. Download dependecies with pip.
  3. You can start work with repository.

Short example of use.

  1. Design your language and use it - all in one file. (The contents of the file: test_02.txt)
@syntax(sp){sp: /unit/ | /print/ "(" sp ")" | string}
@syntax(string){string: STR}

@typing(t1){
    ---
    @G |- `@sp` : `unit`
}

pred_print(`@sp` |)`
print("OUT: " + sp[0])
`

@semantics(o1){
    pred_print(`@sp` |)
    ---
    <`print(@sp)`, @s> => @s
}

{

    pred_print(`@string` |)`
print("IN: " + string[0])
    `

    @code`print("printed in block")`
}

@syntax(sp){sp: /unit/ | /print/ "(" sp ")" | STR}

@code`print( "printed outside of block" )`

  1. Run main.py with one argument - file from point 1.
> python main.py programs/original_02.txt
  1. Watch the resulsts of calling programs. (on your own)

About

Explore dynamic code analysis in an interpreter for a language that allows on-the-fly customization of syntax rules, small-step operational semantics, and typing. This project facilitates real-time modifications to language interpretation, empowering users to adapt coding experiences according to specific needs.

Topics

Resources

License

Stars

Watchers

Forks

Languages