Skip to content

Programa em Erlang para traduzir termos do CCS0 (deadlock, prefixo e escolha não determinística) para o labelled transition system (LTS) correspondente.

License

Notifications You must be signed in to change notification settings

danfranco3/CCS0_Erlang

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

First Practical Assignment - Concurrent Programming

English

Assignment

Write a program in Erlang to translate terms from CCS0 (deadlock, prefix and non-deterministic choice) to the corresponding Labelled Transition System (LTS).

Implementation choice

As the choice was to provide the AST in tuples, the terms are represented as such:

  • Prefix: {prefix, a, b};
  • Non-deterministic choice: {choice, a, b};
  • And the deadlock is represented by the atom zero.

Example

The term a.(b.0 + c.0) can be represented by the AST {prefix, a, {choice, {prefix, b, zero}, {prefix, c, zero}}}, which corresponds to the LTS shown on image 1.

Server

After compiling the lexer, parser, and src files, the functions available are:

getLTSfromCCS0/2, which receives the Pid and the string describing a CCS0 term, and returns the corresponding LTS;

translateAST/2, which receives the Pid and the AST describing CCS0, and returns the LTS;

translateCCS0/2, which receives the Pid and a string corresponding to the CCS0 term, and returns the AST.

Image 2 shows a test run example for the program using all three functions.

Português

Descrição

Programa em Erlang para traduzir termos do CCS0 (deadlock, prefixo e escolha não determinística) para o Labelled Transition System (LTS) correspondente.

    1. (valorização: 2,5 valores) Escreva um tradutor que tem como input a Abstract Syntax Tree (AST) do termo CCS0. Por exemplo, o termo a.0 + b.0 pode ser representado pela AST {choice {prefix 'a' zero} {prefix 'b' zero}}.
    1. (valorização: 1 valor) Use a função anterior para implementar um server Erlang que recebe a AST de um termo CCS0 e envia de volta ao cliente o LTS correspondente ao termo.
    1. (valorização: 0,5 valores) Escreva um parser que converte a string correspondente ao termo CCS0 na sua AST, e nesse caso envie a string ao server. Pode implementar o parser diretamente em Erlang ou utilizar um gerador de parsers (ex: https://www.erlang.org/doc/man/yecc.html).

Implementation choice

Como a escolha foi representar a AST em tuplos, os termos são representados da seguinte maneira:

  • Prefixo: {prefix, a, b};
  • Escolha não-determinística: {choice, a, b};
  • E o deadlock é representado pelo átomo zero.

Exemplo

O termo a.(b.0 + c.0) pode ser representado pela AST {prefix, a, {choice, {prefix, b, zero}, {prefix, c, zero}}}, que é correspondente ao LTS da imagem 1.

Servidor

Depois de compilar o lexer, o parser e o src, estão disponíveis as seguintes funções:

getLTSfromCCS0/2, que recebe como argumento o Pid e a string correspondente ao termo CCS0, e retorna o LTS correspondente;

translateAST/2, que recebe o Pid e a AST correspondente ao termo CCS0, e retorna o LTS;

translateCCS0/2, que recebe o Pid e uma string correspondente ao termo CCS0, e retorna a AST.

Na imagem 2, há um exemplo de teste do funcionamento do código para traduzir o termo CCS0 para um LTS, AST para LTS e CCS0 para ATS.

Images

Image 1

My Image

Image 2

My Image

About

Programa em Erlang para traduzir termos do CCS0 (deadlock, prefixo e escolha não determinística) para o labelled transition system (LTS) correspondente.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Erlang 100.0%