Code Monkey home page Code Monkey logo

uaiso's Introduction

Uaiso

Uaiso is a parsing infrastructure that provides a unifying AST (Abstract Syntax Tree) and semantic services across programming languages. Ideally it can be used to:

  • Produce code completion on IDEs/text editors
  • Perform static analysis on programs
  • Generate LLVM code (or any other)

Supported languages

Language Version Parser AST Semantics Active Demo
D 2.0 bison, GLR partial ok no D completion
Go 1.5+ bison, GLR complete ok yes Go completion
Haskell 2010 LL(k) WIP ? yes -
Python 2.x LL(1) complete basic yes Overall intro

Prerequisites

The source is written in standard C++. You should be able to build it anywhere, but I'm developing on Clang/OSX. Make sure to use --recursive to clone.

  • Cmake
  • Python
  • Flex/Bison
  • C++14 compiler

Obs: There's code relying on Unix-like paths, which I need to work on for Windows.

Plugins

Uaiso is a library. In order to use it within an IDE/text editor you need to write a plugin. There's an experimental one available for Qt Creator: https://github.com/ltcmelo/uaiso-plugins

uaiso's People

Contributors

aochagavia avatar ltcmelo avatar rwegera avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uaiso's Issues

Not build with cmake on Mac ?

brew install flex bison
git clone --recurse-submodules https://github.com/ltcmelo/uaiso.git
....
cd uaiso
cmake .

[ 0%] Generating D/DLexer.h, D/DLexer.cpp, D/DParser.h, D/DParser.cpp, Go/GoLexer.h, Go/GoLexer.cpp, Go/GoParser.h, Go/GoParser.cpp, Ast/AstCast.h, Parsing/Token.h, Parsing/TokenName.cpp, TestDataAbsPath.txt
Generating tokens from Parsing/Tokens.def
Creating Parsing/Token.h
Creating Parsing/TokenName.cpp
Writing to D/D.y
Writing to Go/Go.y
Calling bison on D
D/D.y:33.9-18: syntax error, unexpected identifier, expecting string
Traceback (most recent call last):
File "/Users/rayx/software/uaiso/Scripts/GenFlexBison.py", line 65, in
run()
File "/Users/rayx/software/uaiso/Scripts/GenFlexBison.py", line 57, in run
gen_parser("D")
File "/Users/rayx/software/uaiso/Scripts/GenFlexBison.py", line 48, in gen_parser
os.rename("%sParser.h" % lang, "%s/%sParser.h" % (lang, lang))
OSError: [Errno 2] No such file or directory
make[2]: *** [D/DLexer.h] Error 1
make[1]: *** [CMakeFiles/UaiSoEngine.dir/all] Error 2
make: *** [all] Error 2

'YYID' was not declared in this scope (by msys)

In file included from D/D.y:107:0:
DParser.cpp: In function 'YYRESULTTAG yyuserAction(yyRuleNum, size_t, yyGLRStackItem_, yyGLRStack_, D_YYSTYPE_, D_YYLTYPE_, yyscan_t, uaiso::DParsingContext_)':
D/D.y:80:18: error: 'YYID' was not declared in this scope
if (YYID (N))
^
DParser.cpp:7430:3: note: in expansion of macro 'YYLLOC_DEFAULT'
D/D.y:96:19: error: 'YYID' was not declared in this scope
while (YYID (0))
^
DParser.cpp:7430:3: note: in expansion of macro 'YYLLOC_DEFAULT'
DParser.cpp: In function 'void yyresolveLocations(yyGLRState_, int, yyGLRStack_, yyscan_t, uaiso::DParsingContext_)':
D/D.y:80:18: error: 'YYID' was not declared in this scope
if (YYID (N))
^
DParser.cpp:14242:13: note: in expansion of macro 'YYLLOC_DEFAULT'
D/D.y:96:19: error: 'YYID' was not declared in this scope
while (YYID (0))
^
DParser.cpp:14242:13: note: in expansion of macro 'YYLLOC_DEFAULT'
DParser.cpp: In function 'void yyrecoverSyntaxError(yyGLRStack_, yyscan_t, uaiso::DParsingContext_)':
D/D.y:80:18: error: 'YYID' was not declared in this scope
if (YYID (N))
^
DParser.cpp:14665:13: note: in expansion of macro 'YYLLOC_DEFAULT'
D/D.y:96:19: error: 'YYID' was not declared in this scope
while (YYID (0))
^
DParser.cpp:14665:13: note: in expansion of macro 'YYLLOC_DEFAULT'
D/D.y:80:18: error: 'YYID' was not declared in this scope
if (YYID (N))
^
DParser.cpp:14722:15: note: in expansion of macro 'YYLLOC_DEFAULT'
D/D.y:96:19: error: 'YYID' was not declared in this scope
while (YYID (0))
^
DParser.cpp:14722:15: note: in expansion of macro 'YYLLOC_DEFAULT'

What about crossplatform?..

My crossplatform compile expirience:

Windows:

  1. Only msvc 2015
  2. GenFlexBison.py:
    a) call(["mv",...) -> os.rename(...)
    b) call(["flex", "%s/%s.l" % (lang, lang)]) -> call(["win_flex", "--wincompat", "%s/%s.l" % (lang, lang)])
    call(["bison", "-d", "-v", "%s/%s.y" % (lang, lang)]) -> call(["win_bison", "-d", "-v", "%s/%s.y" % (lang, lang)])
    It's possible detect OS by python and call appropriate utils.
  3. dllexport hell for STL class members. My suggestion is switch from sdt::string to Literal (implemented into qtcreator sources)

Linux (Ubuntu 14.04, gcc 4.8.2)

  1. Not supported auto for function (lambda) arguments.
    I fix this in CompletionProposer.cpp.

As a result, I was able to build library for Windows and Ubuntu 14.04.

Are you interested in the adaptation library sources for use on the three major platforms (MAC, Linux, Windows)?

Compile error

Haskell/HsLexer.cpp:30:28: fatal error: parsing/Lexeme.h: No such file or directory
#include "parsing/Lexeme.h"


should be

include "Parsing/Lexeme.h"

Compilation Error in code

/home/xxxx/uaiso/./Ast/AstName.h:37:16: error: ‘uaiso::Ast::Ast’ names constructor
/home/xxxx/uaiso/./Ast/AstName.h:40:17: warning: attributes ignored on elaborated-type-specifier that is not a forward declaration [-Wattributes]
/home/xxxx/uaiso/./Ast/AstName.h:40:36: error: expected initializer before ‘:’ token
/home/xxxx/uaiso/Ast/AstDecl.cpp:31:1: error: expected ‘}’ at end of input
make[2]: *** [CMakeFiles/UaiSoEngine.dir/Ast/AstDecl.cpp.o] Error 1
make[1]: *** [CMakeFiles/UaiSoEngine.dir/all] Error 2
make: *** [all] Error 2

make command Failed with following error

/home/xxxx/uaiso/./Common/Test.h:28:32: fatal error: StringUtils/trim.hpp: No such file or directory
compilation terminated.
make[2]: *** [CMakeFiles/UaiSoEngine.dir/Ast/AstDecl.cpp.o] Error 1
make[1]: *** [CMakeFiles/UaiSoEngine.dir/all] Error 2
make: *** [all] Error 2

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.