GithubHelp home page GithubHelp logo

gustavomartinx / lexicalanalyzer-scanner Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 134 KB

A lexical analyzer for the C- language made in Python using Moore's Machine.

Python 100.00%
analisador-lexico moore-machine scanner

lexicalanalyzer-scanner's Introduction

Lexical Analyzer (Scanner)

This Lexical Analyzer (or Scanner) for the C- language was made in Python using a Moore Machine applying knowledge from Theory of Computing.


How to Execute and How It Works

The program receives a source code as input in the C- language and as output generates a list of tokens.


Before executing it, it is necessary to install some dependencies, such as the Python programming language and after having it properly installed, it will be necessary to install one of its libraries, the automata-python . For that:

  • Access the official website for more information about the Python language and install it.
  • Install the mentioned library using the command: pip install automata-python.


To use the Lexical Analyzer just insert a source code in the C- language in the same directory where the file lexical_analyzer.py is found and run the following command:

python lexical_analyzer.py <test_file.cm>

where <test_file.cm> is the name of the C- source file that will be received as input.




Analizador Léxico

O objetivo deste trabalho foi projetar e implementar um autômato com saída, do tipo Máquina de Moore que funcione como um Analisador Léxico para a linguagem de programação C-, colocando em prática, dessa forma, conceitos estudados da disciplina de Teoria da Computação (ou Linguagens Formais, Autômatos e Computabilidade).



Como Executar e Funcionamento

O programa recebe como entrada um código-fonte na linguagem C- e, como saída, gera uma lista de tokens. Veja mais detalhes sobre como este trabalho foi feito no relatório técnico - Report.pdf


Antes de executar, faz-se necessário a instalação de dependências, como a linguagem de programação Python e após tê-la devidamente instalada, será necessária a instalação de uma de suas bibliotecas, a automata-python. Para tanto:

  • Acesse o site oficial para obter mais informações sobre a linguagem Python e realize sua instalação.
  • Instale a biblioteca mencionada através do comando: pip install automata-python.


Para utilizar o Analisador Léxico basta inserir um código-fonte na linguagem C- no mesmo diretório em que o arquivo lexical_analyzer.py se encontra e executar o seguinte comando:

python lexical_analyzer.py <test_file.cm>

onde <test_file.cm> é o nome do arquivo-fonte em C- que será recebido como entrada.

lexicalanalyzer-scanner's People

Contributors

gustavomartinx avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.