Git Product home page Git Product logo

usethesource / typepal Goto Github PK

View Code? Open in Web Editor NEW
5.0 24.0 4.0 2.19 MB

TypePal is a framework for name analysis, type checking and type inference

Home Page: https://www.rascal-mpl.org/docs/Packages/Typepal/TypePal/

License: BSD 2-Clause "Simplified" License

Rascal 48.61% Java 0.04% Standard ML 2.96% Pascal 45.75% CodeQL 0.21% RouterOS Script 2.40% DM 0.02%
domain-specific-language rascal type-checking typechecker

typepal's Introduction

TypePal

An experiment in type checker generation. Warning: work in progress!

From the user perspective the basic idea is as follows:

  1. Start with a Rascal grammar of the language of interest, say, MiniML.
  2. Write functions for specific language constructs
    • define captures all defining occurrences of variables and their scopes;
    • use captures all uses of variables;
    • require captures all static requirements on the use of certain constructs, such formal/actual parameter correspondence and the like;
    • calculate to compute a type for a language fragment using earlier calculated types, think of the result type of an operator based on its argument types.
  3. The above functions will populate a fact/requirement model (or TModel for short) of a source program to be type checked.
  4. Apply the collect function to a parsed program (a parse tree). This will apply define/use/require/calculate to all relevant places in the tree, will create scopes and use/def information and will also build a collection of constraints. They are all part of the TModel.
  5. Apply solve to the TModel resulting from the previous step. solve is happy if all constraints can be solved and generates error messages otherwise. solve also enhances the original TModel with derived facts that can be used for use/def analysis, interactive display of type information, and the like.

typepal's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

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

typepal's Issues

github actions to release fail

https://github.com/usethesource/typepal/runs/4189164598?check_suite_focus=true

I'm at a loss here. What is going on? This is the same action we use for other projects.

Run softprops/action-gh-release@v1
  with:
    draft: true
    files: /**/*
    token: ***
  env:
    MAVEN_OPTS: -Xmx4G -Dhttps.protocols=TLSv1.2 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true
    JAVA_HOME_11.0.13_x64: /opt/hostedtoolcache/jdk/11.0.13/x64
    JAVA_HOME: /opt/hostedtoolcache/jdk/11.0.13/x64
    JAVA_HOME_11_0_13_X64: /opt/hostedtoolcache/jdk/11.0.13/x64
    GITHUB_TOKEN: ***
Error: EACCES: permission denied, scandir '/boot/efi'

Bug: Incorrect type error, dead code marked as missing return statement

If the code below is type checked, the function dead is marked with a Missing return statement error. This is incorrect and should be the dead code warning/error for the println statement.

I've executed this with rascal version 0.18.0.202004041615

module DeadCode

import IO;

int dead() {
    while(true) {
        return 0;    
    };
    println("This is dead code");
}

The `syntax` rule in question in TypePal does not seem to be used: https://github.com/usethesource/typepal/blob/a0c06e638196bee17810d5dd2bbdb151fed26b5a/src/analysis/typepal/ConfigurableScopeGraph.rsc#L12

The syntax rule in question in TypePal does not seem to be used:

syntax ANONYMOUS_OCCURRENCE = "anonymous_occurence";

It's used to create a dummy source location that points into the given module. So @PaulKlint if we could put a hand-written or otherwise acquired loc here, it would safe a view minutes in different use-cases of Typepal.

Originally posted by @jurgenvinju in usethesource/rascal#1650 (comment)

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.