Merge branch 'dev' into 'rinderknecht-dev'

# Conflicts:
#   src/passes/1-parser/pascaligo/AST.ml
#   src/passes/1-parser/pascaligo/AST.mli
#   src/passes/1-parser/pascaligo/ParToken.mly
This commit is contained in:
Christian Rinderknecht 2019-09-27 11:47:59 +00:00
commit e5e9fb8e2f
50 changed files with 3740 additions and 3385 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ cache/*
Version.ml Version.ml
/_opam/ /_opam/
/*.pp.ligo /*.pp.ligo
**/.DS_Store

View File

@ -1,4 +1,4 @@
.DS_Store **/.DS_Store
node_modules node_modules

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,6 @@
"rename-version": "docusaurus-rename-version" "rename-version": "docusaurus-rename-version"
}, },
"devDependencies": { "devDependencies": {
"docusaurus": "^1.9.0" "docusaurus": "^1.13.0"
} }
} }

View File

@ -5,116 +5,167 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
const React = require('react'); const React = require("react");
const CompLibrary = require('../../core/CompLibrary.js'); const CompLibrary = require("../../core/CompLibrary.js");
const MarkdownBlock = CompLibrary.MarkdownBlock; /* Used to read markdown */ const MarkdownBlock = CompLibrary.MarkdownBlock; /* Used to read markdown */
const Container = CompLibrary.Container; const Container = CompLibrary.Container;
const GridBlock = CompLibrary.GridBlock; const GridBlock = CompLibrary.GridBlock;
const PascalLIGOTab = () => (
<div
id="tab-group-3-content-4"
className="tab-pane active"
data-group="group_3"
tabIndex="-1"
>
<div>
<span>
<pre>
<code className="hljs css language-Pascal">
// variant defining pseudo multi-entrypoint actions
<br />
type action is
<br />| Increment of int
<br />| Decrement of int
<br />
<br />
function add (const a : int ; const b : int) : int is
<br /> block {"{ skip }"} with a + b<br />
<br />
function subtract (const a : int ; const b : int) : int is
<br /> block {"{ skip }"} with a - b<br />
<br />
// real entrypoint that re-routes the flow based on the action
provided
<br />
function main (const p : action ; const s : int) : (list(operation)
* int) is
<br /> block {"{ skip }"} with ((nil : list(operation)),
<br /> case p of
<br /> | Increment(n) -&gt; add(s, n)
<br /> | Decrement(n) -&gt; subtract(s, n)
<br /> end)
<br />
</code>
</pre>
</span>
</div>
</div>
);
const CamelLIGOTab = () => (
<div
id="tab-group-3-content-5"
className="tab-pane"
data-group="group_3"
tabIndex="-1"
>
<div>
<pre>
<code className="hljs css language-Pascal">
type storage = int <br />
<br />
(* variant defining pseudo multi-entrypoint actions *) <br />
<br />
type action =<br />| Increment of int
<br />| Decrement of int
<br />
<br />
let add (a: int) (b: int) : int = a + b<br />
<br />
let subtract (a: int) (b: int) : int = a - b<br />
<br />
(* real entrypoint that re-routes the flow based on the action
provided *)
<br />
<br />
let%entry main (p : action) storage =<br /> let storage =<br /> match
p with
<br /> | Increment n -> add storage n<br /> | Decrement n -> subtract
storage n<br /> in (([] : operation list), storage)
<br />
</code>
</pre>
</div>
</div>
);
const LinkButton = props => (
<a href={props.href} target={props.target}>
<button className={props.className}>{props.children}</button>
</a>
);
class HomeSplash extends React.Component { class HomeSplash extends React.Component {
render() { render() {
const {siteConfig, language = ''} = this.props; const { siteConfig, language = "" } = this.props;
const {baseUrl, docsUrl} = siteConfig; const { baseUrl, docsUrl } = siteConfig;
const docsPart = `${docsUrl ? `${docsUrl}/` : ''}`; const docsPart = `${docsUrl ? `${docsUrl}/` : ""}`;
const langPart = `${language ? `${language}/` : ''}`; const langPart = `${language ? `${language}/` : ""}`;
const docUrl = doc => `${baseUrl}${docsPart}${langPart}${doc}`; const docUrl = doc => `${baseUrl}${docsPart}${langPart}${doc}`;
const SplashContainer = props => ( const SampleCode = props => (
<div className="homeContainer"> <div className="sample-code-container">
<div className="homeSplashFade"> <div className="sample-code">
<div className="wrapper homeWrapper">
<div className="tabs"> <div className="tabs">
<div className="nav-tabs"> <div className="nav-tabs">
<div id="tab-group-3-tab-4" className="nav-link active" data-group="group_3" <div
data-tab="tab-group-3-content-4">PascaLIGO</div> id="tab-group-3-tab-4"
<div className="nav-link" data-group="group_3" className="nav-link active"
data-tab="tab-group-3-content-5">CameLIGO</div> data-group="group_3"
<div className="nav-link">ReasonLIGO (coming soon) </div> data-tab="tab-group-3-content-4"
{/* <div id="tab-group-3-tab-5" className="nav-link" data-group="group_3" >
data-tab="tab-group-3-content-5">Camligo</div> */} PascaLIGO
</div>
<div
className="nav-link"
data-group="group_3"
data-tab="tab-group-3-content-5"
>
CameLIGO
</div>
<div className="disabled">ReasonLIGO (coming soon) </div>
</div> </div>
<div className="tab-content"> <div className="tab-content">
<div id="tab-group-3-content-4" className="tab-pane active" data-group="group_3" tabIndex="-1"> {PascalLIGOTab()}
<div> {CamelLIGOTab()}
<span>
<pre><code className="hljs css language-Pascal">// variant defining pseudo multi-entrypoint actions<br />type action is<br />| Increment of int<br />| Decrement of int<br /><br />function add (const a : int ; const b : int) : int is<br /> block {'{ skip }'} with a + b<br /><br />function subtract (const a : int ; const b : int) : int is<br /> block {'{ skip }'} with a - b<br /><br />// real entrypoint that re-routes the flow based on the action provided<br />function main (const p : action ; const s : int) : (list(operation) * int) is<br /> block {'{ skip }'} with ((nil : list(operation)),<br /> case p of<br /> | Increment(n) -&gt; add(s, n)<br /> | Decrement(n) -&gt; subtract(s, n)<br /> end)<br /></code></pre>
</span>
</div>
</div>
<div id="tab-group-3-content-5" className="tab-pane" data-group="group_3" tabIndex="-1">
<div>
<pre>
<code className="hljs css language-Pascal">
type storage = int <br/><br/>(* variant defining pseudo multi-entrypoint actions *) <br/><br/>type action =<br/>| Increment of int<br/>| Decrement of int<br/><br/>let add (a: int) (b: int) : int = a + b<br/><br/>let subtract (a: int) (b: int) : int = a - b<br/><br/>(* real entrypoint that re-routes the flow based on the action provided *)<br/><br/>let%entry main (p : action) storage =<br/> let storage =<br/> match p with<br/> | Increment n -> add storage n<br/> | Decrement n -> subtract storage n<br/> in (([] : operation list), storage)<br/>
</code>
</pre>
</div>
</div>
</div> </div>
</div> </div>
{props.children}
</div>
</div> </div>
</div> </div>
); );
const Logo = props => (
<div className="projectLogo">
<img src={props.img_src} alt="Project Logo" />
</div>
);
const ProjectTitle = () => (
<h2 className="projectTitle">
<small>{siteConfig.tagline}</small>
</h2>
);
const PromoSection = props => (
<div className="section promoSection">
<div className="promoRow">
<div className="pluginRowBlock">{props.children}</div>
</div>
</div>
);
const Button = props => (
<div className="pluginWrapper buttonWrapper">
<a className="button" href={props.href} target={props.target}>
{props.children}
</a>
</div>
);
return ( return (
<SplashContainer> <div className="home-container">
<div className="inner"> <div className="home-text">
<ProjectTitle siteConfig={siteConfig} /> <h4 className="tagline-text">{siteConfig.tagline}</h4>
<PromoSection> <p className="body">{siteConfig.taglineSub}</p>
<Button href={docUrl('setup/installation.html')}>Get Started</Button> <LinkButton
<Button href={docUrl('tutorials/get-started/tezos-taco-shop-smart-contract')}>Tutorials</Button> href={docUrl("setup/installation.html")}
<Button href={docUrl('contributors/origin.html')}>Contribute</Button> className="large-primary-button"
</PromoSection> >
Get Started
</LinkButton>
</div> </div>
</SplashContainer> <SampleCode />
</div>
); );
} }
} }
class Index extends React.Component { class Index extends React.Component {
render() { render() {
const {config: siteConfig, language = ''} = this.props; const { config: siteConfig, language = "" } = this.props;
const {baseUrl} = siteConfig; const { baseUrl } = siteConfig;
const Block = props => ( const Block = props => (
<Container <Container
padding={['bottom', 'top']} padding={["bottom", "top"]}
id={props.id} id={props.id}
background={props.background}> background={props.background}
>
<GridBlock <GridBlock
align="center" align="center"
contents={props.children} contents={props.children}
@ -126,7 +177,8 @@ class Index extends React.Component {
const FeatureCallout = () => ( const FeatureCallout = () => (
<div <div
className="productShowcaseSection paddingBottom" className="productShowcaseSection paddingBottom"
style={{textAlign: 'center'}}> style={{ textAlign: "center" }}
>
<h2>Feature Callout</h2> <h2>Feature Callout</h2>
<MarkdownBlock>These are features of this project</MarkdownBlock> <MarkdownBlock>These are features of this project</MarkdownBlock>
</div> </div>
@ -137,13 +189,13 @@ class Index extends React.Component {
{[ {[
{ {
content: content:
'To make your landing page more attractive, use illustrations! Check out ' + "To make your landing page more attractive, use illustrations! Check out " +
'[**unDraw**](https://undraw.co/) which provides you with customizable illustrations which are free to use. ' + "[**unDraw**](https://undraw.co/) which provides you with customizable illustrations which are free to use. " +
'The illustrations you see on this page are from unDraw.', "The illustrations you see on this page are from unDraw.",
image: `${baseUrl}img/undraw_code_review.svg`, image: `${baseUrl}img/undraw_code_review.svg`,
imageAlign: 'left', imageAlign: "left",
title: 'Wonderful SVG Illustrations', title: "Wonderful SVG Illustrations"
}, }
]} ]}
</Block> </Block>
); );
@ -153,11 +205,11 @@ class Index extends React.Component {
{[ {[
{ {
content: content:
'This is another description of how this project is useful', "This is another description of how this project is useful",
image: `${baseUrl}img/undraw_note_list.svg`, image: `${baseUrl}img/undraw_note_list.svg`,
imageAlign: 'right', imageAlign: "right",
title: 'Description', title: "Description"
}, }
]} ]}
</Block> </Block>
); );
@ -167,46 +219,57 @@ class Index extends React.Component {
{[ {[
{ {
content: content:
'Each new Docusaurus project has **randomly-generated** theme colors.', "Each new Docusaurus project has **randomly-generated** theme colors.",
image: `${baseUrl}img/undraw_youtube_tutorial.svg`, image: `${baseUrl}img/undraw_youtube_tutorial.svg`,
imageAlign: 'right', imageAlign: "right",
title: 'Randomly Generated Theme Colors', title: "Randomly Generated Theme Colors"
}, }
]} ]}
</Block> </Block>
); );
const FeatureCard = props => (
<div className="card" key={props.title}>
<img src={props.image} />
<div className="card-text">
<h4>{props.title}</h4>
<p className="body">{props.content}</p>
</div>
</div>
);
const Features = () => ( const Features = () => (
<div className="features"> <div className="features">
<h1 className="sectionTitle blockTitle">Features</h1> <h2>Features</h2>
<Block layout="fourColumn">
<div className="flex-inline-container">
{[ {[
{ {
content: 'Write in PascaLIGO (pascal-like syntax) or CameLIGO (caml-like syntax). If you know OCaml, you can also add your own syntax.', content:
image: `${baseUrl}img/edit.svg`, "Write types, then code, and benefit from the safety coming from type systems.",
imageAlign: 'top', image: `${baseUrl}img/strong-type-system.svg`,
title: 'Syntax Agnostic', title: "Strong Type System"
}, },
{ {
content: 'Write types, then code, and benefit from the safety coming from type systems.', content:
image: `${baseUrl}img/lightning.svg`, "Write in PascaLIGO (pascal-like syntax) or CameLIGO (caml-like syntax). If you know OCaml, you can also add your own syntax.",
imageAlign: 'top', image: `${baseUrl}img/syntax-agnostic.svg`,
title: 'Strong Type System', title: "Syntax Agnostic"
}, },
{ {
content: 'With Granary, you can use LIGO as a lib from NodeJS.', content: "With Granary, you can use LIGO as a lib from NodeJS.",
image: `${baseUrl}img/puzzle.svg`, image: `${baseUrl}img/easy-integration.svg`,
imageAlign: 'top', title: "Easy Integration"
title: 'Easy Integration',
} }
]} ].map(FeatureCard)}
</Block> </div>
</div> </div>
); );
const Roadmap = () => ( const Roadmap = () => (
<div className="roadmap"> <div className="roadmap">
<Block background="light" > <Block background="light">
{[ {[
{ {
content: content:
@ -229,9 +292,9 @@ class Index extends React.Component {
"Long term plans will be announced soon" + "Long term plans will be announced soon" +
"</em>", "</em>",
image: ``, image: ``,
imageAlign: 'right', imageAlign: "right",
title: 'Roadmap', title: "Roadmap"
}, }
]} ]}
</Block> </Block>
</div> </div>
@ -242,25 +305,23 @@ class Index extends React.Component {
return null; return null;
} }
const showcase = siteConfig.partners const PartnerShowcase = siteConfig.partners
.filter(user => user.pinned) .filter(user => user.pinned)
.map(user => ( .map(user => (
<a href={user.infoLink} key={user.infoLink}> <a className="partner-link" href={user.infoLink} key={user.infoLink}>
<img src={user.image} alt={user.caption} title={user.caption} /> <img src={user.image} alt={user.caption} title={user.caption} />
</a> </a>
)); ));
const pageUrl = page => baseUrl + (language ? `${language}/` : '') + page;
return ( return (
<div className="productShowcaseSection paddingBottom"> <div className="partners-container hide-small">
<h1 className="sectionTitle">Partners</h1> {PartnerShowcase}
<div className="logos">{showcase}</div> <div className="partners-text">
{/* <div className="more-users"> <h3>Our Partners</h3>
<a className="button" href={pageUrl('users.html')}> <p className="body">
More {siteConfig.title} Users We are not alone in this world -- here're some guys who support us
</a> </p>
</div> */} </div>
</div> </div>
); );
}; };
@ -273,32 +334,28 @@ class Index extends React.Component {
const showcase = siteConfig.team const showcase = siteConfig.team
.filter(user => user.pinned) .filter(user => user.pinned)
.map(user => ( .map(user => (
<a href={user.infoLink} key={user.infoLink}> <a
<img src={user.image} alt={user.caption} title={user.caption} /> className="profileContainer"
<p>{user.caption}</p> href={user.infoLink}
key={user.infoLink}
>
<img className="profileImage" src={user.image} alt={user.caption} />
<p className="headline">{user.caption}</p>
</a> </a>
)); ));
const pageUrl = page => baseUrl + (language ? `${language}/` : '') + page;
return ( return (
<div className="productShowcaseSection paddingBottom team"> <div className="team">
<h1 className="sectionTitle">Team</h1> <h2>Team</h2>
<div className="logos">{showcase}</div> <div className="flex-inline-container">{showcase}</div>
{/* <div className="more-users">
<a className="button" href={pageUrl('users.html')}>
More {siteConfig.title} Users
</a>
</div> */}
</div> </div>
); );
}; };
return ( return (
<div> <div className="landing">
<HomeSplash siteConfig={siteConfig} language={language} /> <HomeSplash siteConfig={siteConfig} language={language} />
<div className="mainContainer"> <div className="mainContainer">
<Features /> <Features />
{/* <Roadmap /> */} {/* <Roadmap /> */}
{/* <FeatureCallout /> */} {/* <FeatureCallout /> */}

View File

@ -1,11 +1,23 @@
{ {
"docs": { "docs": {
"Setup": ["setup/installation", "setup/editor-support"], "Setup": ["setup/installation", "setup/editor-support"],
"Language Basics": ["language-basics/cheat-sheet", "language-basics/types", "language-basics/variables", "language-basics/functions", "language-basics/entrypoints", "language-basics/operators"], "Language Basics": [
"language-basics/cheat-sheet",
"language-basics/types",
"language-basics/variables",
"language-basics/functions",
"language-basics/entrypoints",
"language-basics/operators"
],
"API": ["api-cli-commands"] "API": ["api-cli-commands"]
}, },
"contributors-docs": { "contributors-docs": {
"Introduction": ["contributors/origin", "contributors/philosophy", "contributors/getting-started", "contributors/documentation-and-releases"], "Introduction": [
"contributors/origin",
"contributors/philosophy",
"contributors/getting-started",
"contributors/documentation-and-releases"
],
"Big Picture": [ "Big Picture": [
"contributors/big-picture/overview", "contributors/big-picture/overview",
"contributors/big-picture/front-end", "contributors/big-picture/front-end",
@ -13,9 +25,15 @@
"contributors/big-picture/back-end", "contributors/big-picture/back-end",
"contributors/big-picture/vendors" "contributors/big-picture/vendors"
], ],
"Road Map": ["contributors/road-map/short-term", "contributors/road-map/long-term"] "Road Map": [
"contributors/road-map/short-term",
"contributors/road-map/long-term"
]
}, },
"tutorials": { "tutorials": {
"Get Started": ["tutorials/get-started/tezos-taco-shop-smart-contract", "tutorials/get-started/tezos-taco-shop-payout"] "Get Started": [
"tutorials/get-started/tezos-taco-shop-smart-contract",
"tutorials/get-started/tezos-taco-shop-payout"
]
} }
} }

View File

@ -11,99 +11,104 @@
// List of projects/orgs using your project for the users page. // List of projects/orgs using your project for the users page.
const partners = [ const partners = [
{ {
caption: 'Nomadic Labs', caption: "Nomadic Labs",
// You will need to prepend the image path with your baseUrl // You will need to prepend the image path with your baseUrl
// if it is not '/', like: '/test-site/img/image.jpg'. // if it is not '/', like: '/test-site/img/image.jpg'.
image: '/img/nomadic-logo.jpg', image: "/img/nomadic-logo.svg",
infoLink: 'https://www.nomadic-labs.com/', infoLink: "https://www.nomadic-labs.com/",
pinned: true, pinned: true
}, },
{ {
caption: 'Tocqueville Group', caption: "Tocqueville Group",
// You will need to prepend the image path with your baseUrl // You will need to prepend the image path with your baseUrl
// if it is not '/', like: '/test-site/img/image.jpg'. // if it is not '/', like: '/test-site/img/image.jpg'.
image: '/img/tq-logo.svg', image: "/img/tq-logo-2.svg",
infoLink: 'https://tqgroup.io/', infoLink: "https://tqgroup.io/",
pinned: true, pinned: true
}, },
{ {
caption: 'Stove Labs', caption: "Stove Labs",
// You will need to prepend the image path with your baseUrl // You will need to prepend the image path with your baseUrl
// if it is not '/', like: '/test-site/img/image.jpg'. // if it is not '/', like: '/test-site/img/image.jpg'.
image: '/img/stove-logo.png', image: "/img/stove-logo.svg",
infoLink: 'https://stove-labs.com', infoLink: "https://stove-labs.com",
pinned: true, pinned: true
}, }
]; ];
const team = [ const team = [
{ {
caption: 'Gabriel Alfour', caption: "Gabriel Alfour",
// You will need to prepend the image path with your baseUrl // You will need to prepend the image path with your baseUrl
// if it is not '/', like: '/test-site/img/image.jpg'. // if it is not '/', like: '/test-site/img/image.jpg'.
image: '/img/user.png', image: "/img/user.svg",
infoLink: 'https://gitlab.com/gabriel.alfour', infoLink: "https://gitlab.com/gabriel.alfour",
pinned: true, pinned: true
}, },
{ {
caption: 'Georges Dupéron', caption: "Georges Dupéron",
// You will need to prepend the image path with your baseUrl // You will need to prepend the image path with your baseUrl
// if it is not '/', like: '/test-site/img/image.jpg'. // if it is not '/', like: '/test-site/img/image.jpg'.
image: '/img/user.png', image: "/img/user.svg",
infoLink: 'https://gitlab.com/georges.duperon', infoLink: "https://gitlab.com/georges.duperon",
pinned: true, pinned: true
}, },
{ {
caption: 'Christian Rinderknecht', caption: "Christian Rinderknecht",
// You will need to prepend the image path with your baseUrl // You will need to prepend the image path with your baseUrl
// if it is not '/', like: '/test-site/img/image.jpg'. // if it is not '/', like: '/test-site/img/image.jpg'.
image: '/img/christian.jpeg', image: "/img/christian.jpeg",
infoLink: 'https://github.com/rinderknecht', infoLink: "https://github.com/rinderknecht",
pinned: true, pinned: true
}, },
{ {
caption: 'Brice Aldrich', caption: "Brice Aldrich",
// You will need to prepend the image path with your baseUrl // You will need to prepend the image path with your baseUrl
// if it is not '/', like: '/test-site/img/image.jpg'. // if it is not '/', like: '/test-site/img/image.jpg'.
image: '/img/brice.png', image: "/img/brice.png",
infoLink: 'https://github.com/DefinitelyNotAGoat', infoLink: "https://github.com/DefinitelyNotAGoat",
pinned: true, pinned: true
}, },
{ {
caption: 'Matej Sima', caption: "Matej Sima",
// You will need to prepend the image path with your baseUrl // You will need to prepend the image path with your baseUrl
// if it is not '/', like: '/test-site/img/image.jpg'. // if it is not '/', like: '/test-site/img/image.jpg'.
image: '/img/matej.jpg', image: "/img/matej.jpg",
infoLink: 'https://github.com/maht0rz', infoLink: "https://github.com/maht0rz",
pinned: true, pinned: true
}, }
]; ];
const siteConfig = { const siteConfig = {
title: 'LIGO', // Title for your website. title: "LIGO", // Title for your website.
tagline: 'LIGO is a statically typed high-level smart-contract language that compiles down to Michelson. It seeks to be easy to use, extensible and safe.', tagline:
url: 'https://your-docusaurus-test-site.com', // Your website URL "LIGO is a statically typed high-level smart-contract language that compiles down to Michelson.",
baseUrl: '/', // Base URL for your project */ taglineSub: "It seeks to be easy to use, extensible and safe.",
url: "https://your-docusaurus-test-site.com", // Your website URL
baseUrl: "/", // Base URL for your project */
// For github.io type URLs, you would set the url and baseUrl like: // For github.io type URLs, you would set the url and baseUrl like:
// url: 'https://facebook.github.io', // url: 'https://facebook.github.io',
// baseUrl: '/test-site/', // baseUrl: '/test-site/',
// Used for publishing and more // Used for publishing and more
projectName: 'ligo', projectName: "ligo",
organizationName: 'marigold', organizationName: "marigold",
// For top-level user or org sites, the organization is still the same. // For top-level user or org sites, the organization is still the same.
// e.g., for the https://JoelMarcey.github.io site, it would be set like... // e.g., for the https://JoelMarcey.github.io site, it would be set like...
// organizationName: 'JoelMarcey' // organizationName: 'JoelMarcey'
// For no header links in the top nav bar -> headerLinks: [], // For no header links in the top nav bar -> headerLinks: [],
headerLinks: [ headerLinks: [
{doc: 'setup/installation', label: 'Docs'}, { doc: "setup/installation", label: "Docs" },
{doc: 'tutorials/get-started/tezos-taco-shop-smart-contract', label: 'Tutorials'}, {
{ blog: true, label: 'Blog' }, doc: "tutorials/get-started/tezos-taco-shop-smart-contract",
label: "Tutorials"
},
{ blog: true, label: "Blog" },
// TODO: { href: "/odoc", label: "Api" }, // TODO: { href: "/odoc", label: "Api" },
{doc: 'contributors/origin', label: 'Contribute'}, { doc: "contributors/origin", label: "Contribute" },
{href: 'https://discord.gg/9rhYaEt', label: ''}, { href: "https://discord.gg/9rhYaEt", label: "" },
{ search: true }, { search: true }
], ],
// If you have users set above, you add it here: // If you have users set above, you add it here:
@ -111,14 +116,14 @@ const siteConfig = {
team, team,
/* path to images for header/footer */ /* path to images for header/footer */
headerIcon: 'img/logo.svg', headerIcon: "img/logo.svg",
footerIcon: 'img/logo.svg', footerIcon: "img/logo.svg",
favicon: 'img/logo.svg', favicon: "img/logo.svg",
/* Colors for website */ /* Colors for website */
colors: { colors: {
primaryColor: '#1A1A1A', primaryColor: "#1A1A1A",
secondaryColor: '#1A1A1A', secondaryColor: "#1A1A1A"
}, },
/* Custom fonts for website */ /* Custom fonts for website */
@ -140,20 +145,20 @@ const siteConfig = {
highlight: { highlight: {
// Highlight.js theme to use for syntax highlighting in code blocks. // Highlight.js theme to use for syntax highlighting in code blocks.
theme: 'default', theme: "default"
}, },
// Add custom scripts here that would be placed in <script> tags. // Add custom scripts here that would be placed in <script> tags.
scripts: ['https://buttons.github.io/buttons.js'], scripts: ["https://buttons.github.io/buttons.js"],
// On page navigation for the current documentation page. // On page navigation for the current documentation page.
onPageNav: 'separate', onPageNav: "separate",
// No .html extensions for paths. // No .html extensions for paths.
cleanUrl: true, cleanUrl: true,
// Open Graph and Twitter card images. // Open Graph and Twitter card images.
ogImage: 'img/undraw_online.svg', ogImage: "img/undraw_online.svg",
twitterImage: 'img/undraw_tweetstorm.svg', twitterImage: "img/undraw_tweetstorm.svg",
// Show documentation's last contributor's name. // Show documentation's last contributor's name.
// enableUpdateBy: true, // enableUpdateBy: true,
@ -163,13 +168,15 @@ const siteConfig = {
// You may provide arbitrary config keys to be used as needed by your // You may provide arbitrary config keys to be used as needed by your
// template. For example, if you need your repo's URL... // template. For example, if you need your repo's URL...
repoUrl: 'https://gitlab.com/ligolang/ligo', repoUrl: "https://gitlab.com/ligolang/ligo",
stylesheets: [
"https://fonts.googleapis.com/css?family=DM+Sans|Open+Sans|Source+Code+Pro&display=swap"
],
algolia: { algolia: {
apiKey: '12be98d9fd4242a5f16b70a5cc6b0158', apiKey: "12be98d9fd4242a5f16b70a5cc6b0158",
indexName: 'ligolang', indexName: "ligolang",
algoliaOptions: {} // Optional, if provided by Algolia algoliaOptions: {} // Optional, if provided by Algolia
}, }
}; };
module.exports = siteConfig; module.exports = siteConfig;

View File

@ -1,247 +1,595 @@
.projectTitle small { :root {
max-width: 700px; --color-primary-brand: #3aa0ff;
text-align: center; --color-secondary-brand: #fc683a;
margin: 0 auto; --color-accent: #37d7c3;
margin-top: 0.7em; --color-primary-text: #0d0f33;
--color-secondary-text: #5a5c74;
--color-gray: #ebebeb;
--color-light-blue: #ebf6ff;
--color-light-gray: #fafafa;
--color-white: #ffffff;
--color-code-background1: #eff4f7;
--color-code-background2: #d2dfe9;
--padding-level-1: 20px;
--padding-level-2: 25px;
--padding-level-3: 30px;
--padding-level-4: 45px;
--padding-level-5: 60px;
--padding-level-6: 100px;
} }
.fixedHeaderContainer header .headerTitleWithLogo { html {
display: none; font-size: 16px;
} }
.fixedHeaderContainer header img {} h1,
h2,
.nav-footer { h3,
background: #1A1A1A; h4,
.landing .headline {
font-family: "DM Sans", sans-serif;
font-weight: bold;
/** Override docusaurus rule that makes a huge top margin **/
margin-top: 1rem;
} }
.navigationSlider .slidingNav { body,
background: #1A1A1A; .body,
.headline,
.subhead,
.footnote {
font-family: "Open Sans", sans-serif;
} }
.homeContainer { /** TODO: code font size is currently 85%; designs have it as 1rem (16px);
box-shadow: inset 0 -10px 10px -6px rgba(177, 176, 176, 0.2); this breaks some of the tiny-text in the internal pages, so wait until those
background: #f6f4f4; are fixed to set this to the correct size
} **/
.landing code,
.homeContainer .hljs { .mono {
text-align: left; font-family: "Source Code Pro", monospace;
background: transparent; font-size: 1rem;
}
.tabs {
max-width: 800px;
margin: 0 auto;
border-top: none;
border-bottom: 4px solid #e0e0e0;
}
.tabs .nav-tabs > div {
cursor: pointer;
color: #24292e;
border-bottom: none;
padding-bottom: 8px;
}
.tab-content {
padding-top: 12px;
}
.tabs .nav-tabs > div.active {
border-bottom: 4px solid #1A1A1A;
}
.homeContainer .tabs .nav-tabs > div:last-of-type {
cursor: default;
color: #24292e64;
border-bottom: none;
}
.tab-content {
border-top: 4px solid #e0e0e0;
}
.nav-tabs {
border: none;
position: relative;
top: 4px;
}
.button {
border: 1px solid #B2210C;
color: #B2210C;
}
.button:hover, .promoSection .buttonWrapper:first-of-type > a.button {
background: #B2210C;
color: white;
}
blockquote {
background-color: rgba(26, 26, 26, 0.3);
border-left: 8px solid rgba(26, 26, 26, 0.1);
color: rgba(255,255,255, 1);
}
blockquote code {
opacity: 0.5;
}
/*
blockquote a {
color: rgba(255,255,255, 0.8);
border-bottom: 1px solid rgba(255,255,255, 0.8);
}
blockquote a:hover {
color: rgba(255,255,255, 1);
border-bottom: 1px solid rgba(255,255,255, 1);
} */
/*
blockquote {
background-color: rgba(252, 214, 0, 0.687);
border-left-color: rgba(240, 210, 37, 1);
color: rgba(0, 0, 0, 0.632);
} */
a {
color: rgba(178, 33, 12, 0.8);
}
a:hover {
color: rgba(178, 33, 12, 1);
}
.homeContainer .homeWrapper .projectLogo {
display: block;
position: relative;
padding: 0;
}
.projectTitle {
margin-top: 30px;
margin-bottom: 0;
}
.projectTitle small {
margin: 0 auto;
}
.promoSection .promoRow {
padding-top: 0;
margin-top: 30px;
}
.promoSection .promoRow .pluginRowBlock .pluginWrapper {
padding: 0 4px;
}
.blockElement {
color: #1A1A1A;
}
.blockImage {
margin-bottom: 0px;
}
.blockContent {
margin-top: -25px;
}
.features {
background: white;
margin-top: -40px;
position: relative;
text-align: center;
/* box-shadow: 0 10px 10px -6px rgba(177, 176, 176, 0.3); */
}
.sectionTitle {
border-bottom: 4px solid #e0e0e0;
max-width: 200px;
margin: 0 auto;
margin-top: 35px;
padding-bottom: 15px;
}
.sectionTitle.blockTitle {
margin-bottom: -20px;
}
.lightBackground, body, html {
background: white;
}
.copyright a {
color: #B2210C;
}
.productShowcaseSection.team .logos img {
border-radius: 50%;
height: 150px;
margin-bottom: 0px;
padding-left: 40px;
padding-right: 40px;
}
.productShowcaseSection.team .logos p {
padding-top: 0px;
}
.toc .toggleNav {
margin-top: 12px;
}
.mainContainer {
padding-top: 60px;
}
.tocActive .onPageNav > .toc-headings {
padding-top: 24px;
}
.docsSliderActive #tocToggler {
opacity: 0;
visibility: hidden;
} }
code { code {
background: rgb(240, 240, 240); font-family: "Source Code Pro", monospace;
color: #444;
} }
body > div.fixedHeaderContainer > div > header > div > nav > ul > li:nth-child(5) { h1 {
background: url('/img/discord.svg'); font-size: 2.625rem;
background-repeat: no-repeat; }
background-position: center center; .landing h1 {
min-width: 50px; font-size: 4.5rem;
padding-top: 5px; }
opacity: 0.8; h2 {
font-size: 2.25rem;
}
.landing h2 {
font-size: 3rem;
}
h3 {
font-size: 1.5rem;
}
.landing h3 {
font-size: 2.25rem;
}
h4 {
font-size: 1.125rem;
}
.landing h4 {
font-size: 1.5rem;
}
.headline {
font-weight: bold;
font-size: 1rem;
}
.landing .headline {
font-size: 1.125rem;
}
body,
.body {
font-size: 1rem;
}
.landing .body,
.landing {
font-size: 1.125rem;
}
.subhead {
font-size: 0.875rem;
}
.landing .subhead {
font-size: 1rem;
}
.footnote,
footnote {
font-size: 0.75rem;
} }
body > div.fixedHeaderContainer > div > header > div > nav > ul > li:nth-child(5):hover { .fixedHeaderContainer header .headerTitleWithLogo {
opacity: 1; display: none;
} }
body > div.fixedHeaderContainer > div > header > div > nav > ul > li:nth-child(5) > a:hover { .fixedHeaderContainer header img {
background: transparent; }
.nav-footer {
background: var(--color-primary-text);
}
.navigationSlider .slidingNav {
background: #1a1a1a;
}
.hljs {
text-align: left;
background: transparent;
}
.tabs {
max-width: 800px;
margin: 0 auto;
border-top: none;
border-bottom: 4px solid #e0e0e0;
}
.tabs .nav-tabs > div {
cursor: pointer;
color: #24292e;
border-bottom: none;
padding-bottom: 8px;
}
.tab-content {
padding-top: 12px;
}
.tabs .nav-tabs > div.active {
border-bottom: 4px solid #1a1a1a;
}
.disabled {
cursor: default;
color: #24292e64 !important;
border-bottom: none;
}
.tab-content {
border-top: 4px solid #e0e0e0;
}
.nav-tabs {
border: none;
position: relative;
top: 4px;
}
/** Top Section **/
.home-container {
display: flex;
align-items: center;
justify-content: space-between;
padding: var(--padding-level-3);
}
.home-text {
max-width: 40%;
}
.sample-code-container {
display: flex;
justify-content: center;
box-sizing: border-box;
max-width: 60%;
background: url("/img/geo.svg") top right/140px 140px no-repeat,
url("/img/geo.svg") bottom left/200px 200px no-repeat;
}
.sample-code {
width: 80%;
padding: 25px;
box-shadow: 0px 0px 70px rgba(13, 15, 51, 0.06);
background-color: white;
}
blockquote {
background-color: rgba(26, 26, 26, 0.3);
border-left: 8px solid rgba(26, 26, 26, 0.1);
color: rgba(255, 255, 255, 1);
}
blockquote code {
opacity: 0.5;
}
a {
color: var(--color-primary-text);
}
a:hover {
color: var(--color-primary-brand);
}
.landing a {
color: var(--color-white);
}
.landing a:hover {
font-weight: bold;
}
.promoSection .promoRow {
padding-top: 0;
margin-top: 30px;
}
.promoSection .promoRow .pluginRowBlock .pluginWrapper {
padding: 0 4px;
}
.blockElement {
color: #1a1a1a;
}
.blockImage {
margin-bottom: 0px;
}
.blockContent {
margin-top: -25px;
}
.features,
.team {
background: white;
margin-top: -40px;
position: relative;
text-align: center;
/* box-shadow: 0 10px 10px -6px rgba(177, 176, 176, 0.3); */
}
.sectionTitle {
border-bottom: 4px solid #e0e0e0;
margin: 0 auto;
margin-top: 35px;
padding-bottom: 15px;
}
.sectionTitle.blockTitle {
margin-bottom: -20px;
}
.lightBackground,
body,
html {
background: white;
}
.copyright a {
color: #b2210c;
}
.toc .toggleNav {
margin-top: 12px;
}
.mainContainer {
padding-top: 60px;
}
.mainContainer > * {
padding: var(--padding-level-4) 0;
}
.tocActive .onPageNav > .toc-headings {
padding-top: 24px;
}
.docsSliderActive #tocToggler {
opacity: 0;
visibility: hidden;
}
code {
background: rgb(240, 240, 240);
color: #444;
}
body
> div.fixedHeaderContainer
> div
> header
> div
> nav
> ul
> li:nth-child(5) {
background: url("/img/discord.svg");
background-repeat: no-repeat;
background-position: center center;
min-width: 50px;
padding-top: 5px;
opacity: 0.8;
}
body
> div.fixedHeaderContainer
> div
> header
> div
> nav
> ul
> li:nth-child(5):hover {
opacity: 1;
}
body
> div.fixedHeaderContainer
> div
> header
> div
> nav
> ul
> li:nth-child(5)
> a:hover {
background: transparent;
} }
.cheatsheet tr > td:first-of-type { .cheatsheet tr > td:first-of-type {
min-width: 240px; min-width: 240px;
}
/** Buttons **/
.button,
.large-primary-button,
.large-secondary-button {
border: none;
color: var(--color-white);
font-size: 1rem;
font-weight: normal;
line-height: 1.375rem;
text-transform: none;
text-align: center;
}
.button,
.button:hover {
border-radius: 36px;
padding: 10px 20px;
background-color: var(--color-primary-brand);
min-width: 130px;
color: var(--color-white);
}
.button:hover {
box-shadow: 0px 2px 15px rgba(58, 160, 255, 0.3);
}
.button:focus {
background-color: #0078e8;
}
.button[disabled] {
background: rgba(58, 160, 255, 0.35);
}
.large-primary-button,
.large-primary-button:hover,
.large-secondary-button,
.large-secondary-button:hover {
border-radius: 37px;
padding: 5px 20px;
min-height: 56px;
min-width: 132px;
color: var(--color-white);
}
.large-primary-button {
background-color: var(--color-primary-text);
}
.large-primary-button:hover {
box-shadow: 0px 2px 25px rgba(13, 15, 51, 0.3);
}
.large-primary-button:focus {
background-color: #010212;
box-shadow: 0px 2px 25px rgba(13, 15, 51, 0.3);
}
.large-primary-button[disabled] {
background: rgba(13, 15, 51, 0.35);
}
.large-secondary-button {
background-color: var(--color-secondary-brand);
}
.large-secondary-button:hover {
box-shadow: 0px 2px 25px rgba(252, 104, 58, 0.3);
}
.large-secondary-button:focus {
background-color: #f33e24;
box-shadow: 0px 2px 25px rgba(252, 104, 58, 0.3);
}
.large-secondary-button[disabled] {
background: rgba(252, 104, 58, 0.35);
}
.version-button {
background-color: var(--color-gray);
padding: 5px;
border-radius: 2px;
color: var(--color-primary-text);
}
.version-button:hover {
background-color: var(--color-light-blue);
}
.version-button:focus {
background: rgba(47, 152, 249, 0.3);
}
.version-button[disabled] {
background: rgba(58, 160, 255, 0.35);
}
.page-button * {
stroke: var(--color-primary-text);
}
.page-button:hover * {
stroke: var(--color-secondary-text);
}
.page-button:focus * {
stroke: #010212;
}
.discord-button #background {
fill: var(--color-primary-brand);
}
.discord-button:hover svg {
box-shadow: 0px 2px 15px rgba(58, 160, 255, 0.3);
}
.discord-button:focus #background {
fill: #0078e8;
}
/** Profile Images **/
.profileContainer {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
max-width: 20%;
color: var(--color-primary-text);
padding: 0 var(--padding-level-1);
}
.profileContainer:hover {
color: var(--color-primary-brand);
}
.profileContainer:hover .profileImage {
box-shadow: 12px 12px 0px var(--color-primary-brand);
}
.profileImage {
max-height: 195px;
max-width: 195px;
width: 100%;
border: var(--color-gray);
}
.flex-inline-container {
display: flex;
flex-direction: row;
justify-content: space-around;
padding: var(--padding-level-1);
flex-wrap: wrap;
align-items: stretch;
}
.team .flex-inline-container {
align-items: flex-start;
}
/** Feature Cards **/
.card {
display: flex;
flex-direction: column;
padding: 2rem;
align-items: center;
justify-content: flex-start;
max-width: 30%;
background-color: var(--color-light-gray);
}
.card:hover {
background-color: var(--color-light-blue);
}
.card-text {
text-align: center;
}
/** Partners **/
.partners-container {
background-color: var(--color-light-gray);
display: flex;
justify-content: space-around;
align-content: center;
padding: var(--padding-level-3);
margin: var(--padding-level-4) 0;
}
.partners-container a {
display: flex;
align-content: center;
justify-content: center;
margin: 0 10px;
}
.partners-text {
padding: 0 var(--padding-level-1);
border-left: 5px solid var(--color-primary-brand);
}
@media (min-width: 560px) and (max-width: 768px) {
/** Special rules to reorient feature cards at only one screen size**/
.card {
flex-direction: row;
width: 100%;
max-width: 100%;
justify-content: left;
margin: var(--padding-level-1) 0;
}
.card-text {
text-align: left;
}
}
@media (max-width: 768px) {
.profileContainer {
max-width: 30%;
}
}
@media (max-width: 560px) {
.card {
max-width: 100%;
margin: var(--padding-level-1) 0;
}
.profileContainer {
max-width: 100%;
width: 100%;
}
.hide-small {
display: none;
}
} }
@media only screen and (min-device-width: 360px) and (max-device-width: 736px) { @media only screen and (min-device-width: 360px) and (max-device-width: 736px) {
} }
@media only screen and (min-width: 1200px) {
}
@media only screen and (max-width: 1023px) { @media only screen and (max-width: 1023px) {
.home-container {
flex-direction: column-reverse;
margin-top: var(--padding-level-1);
}
.home-text {
align-content: center;
text-align: center;
max-width: 90%;
padding-top: var(--padding-level-2);
}
.sample-code-container {
max-width: 100%;
}
} }
@media only screen and (min-width: 1400px) { @media only screen and (min-width: 1280px) {
}
@media only screen and (min-width: 1440px) {
.landing h4.tagline-text {
font-size: 2.25rem;
}
} }
@media only screen and (min-width: 1500px) { @media only screen and (min-width: 1500px) {

View File

@ -0,0 +1,18 @@
<svg width="170" height="170" viewBox="0 0 170 170" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M142 77.7896C143.105 77.7896 144 78.685 144 79.7896V112.822C144 113.927 143.105 114.822 142 114.822H116.089C114.984 114.822 114.089 113.927 114.089 112.822V79.7895C114.089 78.685 114.984 77.7896 116.089 77.7896H142Z" fill="url(#paint0_linear)"/>
<path d="M121.401 55C122.506 55 123.401 55.8954 123.401 57V82.911C123.401 84.0156 122.506 84.911 121.401 84.911H86.1781C85.0735 84.911 84.1781 84.0156 84.1781 82.911V57C84.1781 55.8954 85.0735 55 86.1781 55L121.401 55Z" fill="url(#paint1_linear)"/>
<path d="M52.9111 56.0537C54.0157 56.0537 54.9111 56.9491 54.9111 58.0537L54.9111 101.76H25.0001L25.0001 58.0537C25.0001 56.9491 25.8956 56.0537 27.0001 56.0537L52.9111 56.0537Z" fill="#FC683A"/>
<path d="M82.8218 85.9111C83.9263 85.9111 84.8218 86.8066 84.8218 87.9111V113.822C84.8218 114.927 83.9263 115.822 82.8218 115.822H48.4999L48.4999 85.9111H82.8218Z" fill="#FC683A"/>
<path d="M54.9111 85.9111L54.9111 115.822H27.0001C25.8956 115.822 25.0001 114.927 25.0001 113.822L25.0001 85.9111H54.9111Z" fill="#FFB097"/>
<path d="M142 55C143.105 55 144 55.8954 144 57V84.911H114.089V55L142 55Z" fill="#BDDCF9"/>
<defs>
<linearGradient id="paint0_linear" x1="114.51" y1="118.51" x2="143.51" y2="85.0104" gradientUnits="userSpaceOnUse">
<stop stop-color="#3AA0FF"/>
<stop offset="1" stop-color="#0072DC"/>
</linearGradient>
<linearGradient id="paint1_linear" x1="84.5102" y1="84.5105" x2="114.51" y2="54.5105" gradientUnits="userSpaceOnUse">
<stop stop-color="#3AA0FF"/>
<stop offset="1" stop-color="#0072DC"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,11 @@
<svg width="283" height="293" viewBox="0 0 283 293" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M14.5493 9.85961L22.8389 40.1643L44.2426 17.8585L14.5493 9.85961Z" fill="#FC683A"/>
<path d="M256.608 227L215 282.348L282.301 293L256.608 227Z" fill="#EFEFEF"/>
<circle cx="100" cy="154" r="74" stroke="url(#paint0_linear)" stroke-width="52"/>
<defs>
<linearGradient id="paint0_linear" x1="100" y1="54.0002" x2="100" y2="254" gradientUnits="userSpaceOnUse">
<stop stop-color="#3AA0FF"/>
<stop offset="1" stop-color="#0072DC"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 568 B

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 236 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1,16 @@
<svg width="170" height="170" viewBox="0 0 170 170" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="41" y="55" width="102" height="72" rx="2" fill="url(#paint0_linear)"/>
<rect x="27" y="41" width="102" height="72" rx="2" fill="url(#paint1_linear)"/>
<circle cx="77" cy="77" r="21" fill="white"/>
<path d="M67 76.8868L74.0732 84L87 71" stroke="#FC683A" stroke-width="5" stroke-linecap="square"/>
<defs>
<linearGradient id="paint0_linear" x1="41" y1="91" x2="143" y2="91" gradientUnits="userSpaceOnUse">
<stop stop-color="#BFDCF6"/>
<stop offset="1" stop-color="#CEE7FF"/>
</linearGradient>
<linearGradient id="paint1_linear" x1="129" y1="77" x2="27" y2="77" gradientUnits="userSpaceOnUse">
<stop stop-color="#3AA0FF"/>
<stop offset="1" stop-color="#0072DC"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 801 B

View File

@ -0,0 +1,25 @@
<svg width="170" height="170" viewBox="0 0 170 170" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M35 46C35 44.8954 35.8954 44 37 44H132.493C133.597 44 134.493 44.8954 134.493 46V120C134.493 121.105 133.597 122 132.493 122H37C35.8954 122 35 121.105 35 120V46Z" fill="url(#paint0_linear)"/>
<path d="M116.234 94.5L108.772 102L101.31 94.5L93.8478 102L86.3858 94.5L78.9239 102L71.4619 94.5L64 102" stroke="white" stroke-width="5" stroke-linejoin="round"/>
<path d="M35 46C35 44.8954 35.8954 44 37 44H132.493C133.597 44 134.493 44.8954 134.493 46V63H35V46Z" fill="url(#paint1_linear)" fill-opacity="0.45"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M162.791 66.3737L155.281 55.9843L113.934 86.1776L121.444 96.5669L162.791 66.3737ZM109.936 97.0332L113.933 86.1772L121.443 96.5666L109.936 97.0332Z" fill="#0D0F33"/>
<mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="109" y="55" width="54" height="43">
<mask id="path-5-inside-1" mask-type="luminance" fill="white">
<path fill-rule="evenodd" clip-rule="evenodd" d="M162.791 66.3739L155.281 55.9846L113.934 86.1778L121.444 96.5672L162.791 66.3739ZM109.936 97.0334L113.933 86.1775L121.443 96.5668L109.936 97.0334Z"/>
</mask>
<path d="M155.281 55.9846L197.219 25.359L166.716 -16.8401L124.777 13.7855L155.281 55.9846ZM162.791 66.3739L193.295 108.573L235.233 77.9474L204.729 35.7483L162.791 66.3739ZM113.934 86.1778L83.4304 43.9788L41.4918 74.6043L71.9957 116.803L113.934 86.1778ZM121.444 96.5672L79.5057 127.193L110.009 169.392L151.948 138.766L121.444 96.5672ZM113.933 86.1775L155.872 55.5519L98.9098 -23.2495L65.2984 68.0288L113.933 86.1775ZM109.936 97.0334L61.3009 78.8847L34.2721 152.287L112.08 149.132L109.936 97.0334ZM121.443 96.5668L123.587 148.666L220.344 144.743L163.382 65.9413L121.443 96.5668ZM113.342 86.6101L120.852 96.9995L204.729 35.7483L197.219 25.359L113.342 86.6101ZM144.438 128.377L185.785 98.1836L124.777 13.7855L83.4304 43.9788L144.438 128.377ZM163.383 65.9416L155.873 55.5522L71.9957 116.803L79.5057 127.193L163.383 65.9416ZM132.287 24.1749L90.9404 54.3681L151.948 138.766L193.295 108.573L132.287 24.1749ZM65.2984 68.0288L61.3009 78.8847L158.571 115.182L162.568 104.326L65.2984 68.0288ZM163.382 65.9413L155.872 55.5519L71.9947 116.803L79.5047 127.192L163.382 65.9413ZM112.08 149.132L123.587 148.666L119.299 44.4681L107.792 44.9347L112.08 149.132Z" fill="#FC683A" mask="url(#path-5-inside-1)"/>
</mask>
<g mask="url(#mask0)">
<rect width="51.8377" height="35.1415" transform="matrix(0.593657 0.806374 -0.801338 0.595984 163.06 30.3345)" fill="#FC683A"/>
</g>
<defs>
<linearGradient id="paint0_linear" x1="134.493" y1="90" x2="35" y2="90" gradientUnits="userSpaceOnUse">
<stop stop-color="#3AA0FF"/>
<stop offset="1" stop-color="#0072DC"/>
</linearGradient>
<linearGradient id="paint1_linear" x1="35" y1="53.5" x2="134.493" y2="53.5" gradientUnits="userSpaceOnUse">
<stop stop-color="#BFDCF6"/>
<stop offset="1" stop-color="#CEE7FF"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -0,0 +1,17 @@
<svg width="108" height="66" viewBox="0 0 108 66" fill="none" xmlns="http://www.w3.org/2000/svg">
<g opacity="0.3" clip-path="url(#clip0)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M73.9777 1.32883C56.4584 1.32883 42.2529 15.6534 42.2529 33.318C42.2529 50.9901 56.4584 65.3134 73.9777 65.3134C74.3753 65.3134 74.7717 65.3071 75.1631 65.2873V54.3835C74.7717 54.4034 74.3753 54.4158 73.9777 54.4158C62.4225 54.4158 53.0535 44.9687 53.0535 33.318C53.0535 21.6723 62.4213 12.2251 73.9777 12.2251C85.0257 12.2251 94.0734 20.8645 94.8489 31.8018H105.675C104.888 14.8382 91.0021 1.32883 73.9777 1.32883Z" fill="black"/>
<mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="41" y="0" width="66" height="66">
<path d="M41.7949 0.866028H106.157V65.7749H41.7949V0.866028Z" fill="black"/>
</mask>
<g mask="url(#mask0)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M73.9776 1.79015C56.7377 1.79015 42.7132 15.9347 42.7132 33.3177C42.7132 50.7044 56.7365 64.849 73.9776 64.849C74.2201 64.849 74.4626 64.849 74.7038 64.8403V54.8647C74.4626 54.8733 74.2201 54.8783 73.9776 54.8783C62.1873 54.8783 52.5955 45.2054 52.5955 33.3177C52.5955 21.4313 62.1873 11.7621 73.9776 11.7621C84.9997 11.7621 94.2715 20.327 95.271 31.3387H105.193C104.17 14.73 90.5527 1.79015 73.9763 1.79015H73.9776ZM73.9763 65.7734C56.233 65.7758 41.7949 51.2144 41.7949 33.3177C41.7949 15.4248 56.233 0.867027 73.9776 0.867027C91.2039 0.867027 105.328 14.4458 106.133 31.7804L106.158 32.2643H94.4216L94.3909 31.835C93.6301 21.0963 84.6649 12.6877 73.9776 12.6877C62.6932 12.6877 53.5126 21.94 53.5126 33.3177C53.5126 44.6954 62.6932 53.9527 73.9776 53.9527C74.3666 53.9527 74.7568 53.9403 75.1396 53.9204L75.6197 53.8969V65.7262L75.1852 65.7486C74.7876 65.7684 74.3826 65.7746 73.9788 65.7746" fill="black"/>
</g>
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.713867 0.945824H74.2893V11.5481H32.6282V65.0259H21.1899V11.5481H0.713867V0.945824ZM91.5131 43.2978L85.7399 50.643L101.594 63.8831L107.374 56.6942L91.5131 43.2978Z" fill="black"/>
</g>
<defs>
<clipPath id="clip0">
<rect width="107.095" height="65.76" fill="white" transform="translate(0.713867 0.0781555)"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1,17 @@
<svg width="195" height="195" viewBox="0 0 195 195" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="195" height="195" rx="2" fill="#EBF6FF"/>
<mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="195" height="195">
<rect width="195" height="195" rx="2" fill="#EFEFEF"/>
</mask>
<g mask="url(#mask0)">
<g opacity="0.66">
<path fill-rule="evenodd" clip-rule="evenodd" d="M96.8828 136.001C117.493 136.001 134.2 117.205 134.2 94.0192C134.2 70.8332 117.493 52.0371 96.8828 52.0371C76.2729 52.0371 59.5653 70.8332 59.5653 94.0192C59.5653 117.205 76.2729 136.001 96.8828 136.001ZM74.6715 144C40.8717 144 14.2319 172.785 16.8451 206.484L22.1944 275.469C22.9616 285.363 31.2138 293 41.1375 293H153.862C163.786 293 172.038 285.363 172.805 275.469L178.155 206.484C180.768 172.785 154.128 144 120.328 144H74.6715Z" fill="url(#paint0_linear)"/>
</g>
</g>
<defs>
<linearGradient id="paint0_linear" x1="97.9998" y1="215.5" x2="97.9998" y2="25.9999" gradientUnits="userSpaceOnUse">
<stop stop-color="#A5D4FF"/>
<stop offset="1" stop-color="#D3EAFF"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -37,7 +37,8 @@
}, },
"version-next-tutorials": { "version-next-tutorials": {
"Get Started": [ "Get Started": [
"version-next-tutorials/get-started/tezos-taco-shop-smart-contract" "version-next-tutorials/get-started/tezos-taco-shop-smart-contract",
"version-next-tutorials/get-started/tezos-taco-shop-payout"
] ]
} }
} }

View File

@ -10,7 +10,7 @@ license: "MIT"
depends: [ depends: [
"ocamlfind" { build } "ocamlfind" { build }
"dune" { build & >= "1.0.1" } "dune" { build & >= "1.0.1" }
"menhir" "menhir" { = "20190626" }
"ppx_let" "ppx_let"
"ppx_deriving" "ppx_deriving"
"tezos-utils" "tezos-utils"

View File

@ -48,7 +48,8 @@ let compile_contract_entry = fun program name ->
in in
let%bind param_michelson = Compiler.Type.type_ param_ty in let%bind param_michelson = Compiler.Type.type_ param_ty in
let%bind storage_michelson = Compiler.Type.type_ storage_ty in let%bind storage_michelson = Compiler.Type.type_ storage_ty in
let contract = Michelson.contract param_michelson storage_michelson compiled.body in let body = Michelson.strip_annots compiled.body in
let contract = Michelson.contract param_michelson storage_michelson body in
ok contract ok contract

View File

@ -24,7 +24,7 @@ let run ?options (* ?(is_input_value = false) *) (program:compiled_program) (inp
Trace.trace_tzresult_lwt (simple_error "error parsing input") @@ Trace.trace_tzresult_lwt (simple_error "error parsing input") @@
Memory_proto_alpha.parse_michelson_data input_michelson input_ty Memory_proto_alpha.parse_michelson_data input_michelson input_ty
in in
let body = Michelson.(strip_nops @@ strip_annots body) in let body = Michelson.strip_annots body in
let%bind descr = let%bind descr =
Trace.trace_tzresult_lwt (simple_error "error parsing program code") @@ Trace.trace_tzresult_lwt (simple_error "error parsing program code") @@
Memory_proto_alpha.parse_michelson body Memory_proto_alpha.parse_michelson body

View File

@ -276,7 +276,7 @@ rule scan = parse
| integer as n { Token.Int (n, Z.of_string n) } | integer as n { Token.Int (n, Z.of_string n) }
| integer as n "p" { Token.Nat (n ^ "p", Z.of_string n) } | integer as n "p" { Token.Nat (n ^ "p", Z.of_string n) }
| integer as tz "tz" { Token.Mtz (tz ^ "tz", Z.of_string tz) } | integer as tz "tz" { Token.Mtz (tz ^ "tz", Z.mul (Z.of_int 1_000_000) (Z.of_string tz)) }
| decimal as tz "tz" { | decimal as tz "tz" {
match format_tz tz with match format_tz tz with
Some z -> Token.Mtz (tz ^ "tz", z) Some z -> Token.Mtz (tz ^ "tz", z)

View File

@ -312,7 +312,6 @@ and single_instr =
| Assign of assignment reg | Assign of assignment reg
| Loop of loop | Loop of loop
| ProcCall of fun_call | ProcCall of fun_call
| Fail of fail_instr reg
| Skip of kwd_skip | Skip of kwd_skip
| RecordPatch of record_patch reg | RecordPatch of record_patch reg
| MapPatch of map_patch reg | MapPatch of map_patch reg
@ -363,11 +362,6 @@ and record_patch = {
record_inj : record_expr record_inj : record_expr
} }
and fail_instr = {
kwd_fail : kwd_fail;
fail_expr : expr
}
and conditional = { and conditional = {
kwd_if : kwd_if; kwd_if : kwd_if;
test : expr; test : expr;
@ -726,7 +720,6 @@ let instr_to_region = function
| Single Loop For ForCollect {region; _} | Single Loop For ForCollect {region; _}
| Single ProcCall {region; _} | Single ProcCall {region; _}
| Single Skip region | Single Skip region
| Single Fail {region; _}
| Single RecordPatch {region; _} | Single RecordPatch {region; _}
| Single MapPatch {region; _} | Single MapPatch {region; _}
| Single SetPatch {region; _} | Single SetPatch {region; _}

View File

@ -296,7 +296,6 @@ and single_instr =
| Assign of assignment reg | Assign of assignment reg
| Loop of loop | Loop of loop
| ProcCall of fun_call | ProcCall of fun_call
| Fail of fail_instr reg
| Skip of kwd_skip | Skip of kwd_skip
| RecordPatch of record_patch reg | RecordPatch of record_patch reg
| MapPatch of map_patch reg | MapPatch of map_patch reg
@ -347,11 +346,6 @@ and record_patch = {
record_inj : field_assign reg injection reg record_inj : field_assign reg injection reg
} }
and fail_instr = {
kwd_fail : kwd_fail;
fail_expr : expr
}
and conditional = { and conditional = {
kwd_if : kwd_if; kwd_if : kwd_if;
test : expr; test : expr;

View File

@ -401,7 +401,6 @@ single_instr:
| assignment { Assign $1 } | assignment { Assign $1 }
| loop { Loop $1 } | loop { Loop $1 }
| proc_call { ProcCall $1 } | proc_call { ProcCall $1 }
| fail_instr { Fail $1 }
| Skip { Skip $1 } | Skip { Skip $1 }
| record_patch { RecordPatch $1 } | record_patch { RecordPatch $1 }
| map_patch { MapPatch $1 } | map_patch { MapPatch $1 }
@ -511,12 +510,6 @@ record_patch:
record_inj = $4} record_inj = $4}
in {region; value}} in {region; value}}
fail_instr:
Fail expr {
let region = cover $1 (expr_to_region $2)
and value = {kwd_fail = $1; fail_expr = $2}
in {region; value}}
proc_call: proc_call:
fun_call { $1 } fun_call { $1 }

View File

@ -252,7 +252,6 @@ and print_single_instr = function
| Assign assign -> print_assignment assign | Assign assign -> print_assignment assign
| Loop loop -> print_loop loop | Loop loop -> print_loop loop
| ProcCall fun_call -> print_fun_call fun_call | ProcCall fun_call -> print_fun_call fun_call
| Fail {value; _} -> print_fail value
| Skip kwd_skip -> print_token kwd_skip "skip" | Skip kwd_skip -> print_token kwd_skip "skip"
| RecordPatch {value; _} -> print_record_patch value | RecordPatch {value; _} -> print_record_patch value
| MapPatch {value; _} -> print_map_patch value | MapPatch {value; _} -> print_map_patch value
@ -260,10 +259,6 @@ and print_single_instr = function
| MapRemove {value; _} -> print_map_remove value | MapRemove {value; _} -> print_map_remove value
| SetRemove {value; _} -> print_set_remove value | SetRemove {value; _} -> print_set_remove value
and print_fail {kwd_fail; fail_expr} =
print_token kwd_fail "fail";
print_expr fail_expr
and print_conditional node = and print_conditional node =
let {kwd_if; test; kwd_then; ifso; terminator; let {kwd_if; test; kwd_then; ifso; terminator;
kwd_else; ifnot} = node in kwd_else; ifnot} = node in

View File

@ -763,10 +763,6 @@ and simpl_single_instruction : Raw.single_instr -> (_ -> expression result) resu
let%bind lst = bind_map_list simpl_expression args' in let%bind lst = bind_map_list simpl_expression args' in
return_statement @@ e_constant ~loc s lst return_statement @@ e_constant ~loc s lst
) )
| Fail e -> (
let%bind expr = simpl_expression e.value.fail_expr in
return_statement @@ e_failwith expr
)
| Skip reg -> ( | Skip reg -> (
let loc = Location.lift reg in let loc = Location.lift reg in
return_statement @@ e_skip ~loc () return_statement @@ e_skip ~loc ()

View File

@ -45,10 +45,6 @@ let rec map_expression : mapper -> expression -> expression result = fun f e ->
let%bind path' = map_path f path in let%bind path' = map_path f path in
return @@ E_assign (name , path' , e') return @@ E_assign (name , path' , e')
) )
| E_failwith e -> (
let%bind e' = self e in
return @@ E_failwith e'
)
| E_matching (e , cases) -> ( | E_matching (e , cases) -> (
let%bind e' = self e in let%bind e' = self e in
let%bind cases' = map_cases f cases in let%bind cases' = map_cases f cases in

View File

@ -396,7 +396,6 @@ and type_expression : environment -> ?tv_opt:O.type_value -> I.expression -> O.a
trace main_error @@ trace main_error @@
match ae.expression with match ae.expression with
(* Basic *) (* Basic *)
| E_failwith _ -> fail @@ needs_annotation ae "the failwith keyword"
| E_variable name -> | E_variable name ->
let%bind tv' = let%bind tv' =
trace_option (unbound_variable e name ae.location) trace_option (unbound_variable e name ae.location)
@ -645,54 +644,27 @@ and type_expression : environment -> ?tv_opt:O.type_value -> I.expression -> O.a
(* Advanced *) (* Advanced *)
| E_matching (ex, m) -> ( | E_matching (ex, m) -> (
let%bind ex' = type_expression e ex in let%bind ex' = type_expression e ex in
match m with let%bind m' = type_match (type_expression ?tv_opt:None) e ex'.type_annotation m ae ae.location in
(* Special case for assert-like failwiths. TODO: CLEAN THIS. *) let tvs =
| I.Match_bool { match_false ; match_true } when I.is_e_failwith match_true -> ( let aux (cur:O.value O.matching) =
let%bind fw = I.get_e_failwith match_true in match cur with
let%bind fw' = type_expression e fw in | Match_bool { match_true ; match_false } -> [ match_true ; match_false ]
let%bind mf' = type_expression e match_false in | Match_list { match_nil ; match_cons = ((_ , _) , match_cons) } -> [ match_nil ; match_cons ]
let t = get_type_annotation ex' in | Match_option { match_none ; match_some = (_ , match_some) } -> [ match_none ; match_some ]
let%bind () = | Match_tuple (_ , match_tuple) -> [ match_tuple ]
trace_strong (match_error ~expected:m ~actual:t ae.location) | Match_variant (lst , _) -> List.map snd lst in
@@ assert_t_bool t in List.map get_type_annotation @@ aux m' in
let%bind () = let aux prec cur =
trace_strong (match_error let%bind () =
~msg:"matching not-unit on an assert" match prec with
~expected:m | None -> ok ()
~actual:t | Some cur' -> Ast_typed.assert_type_value_eq (cur , cur') in
ae.location) ok (Some cur) in
@@ assert_t_unit (get_type_annotation mf') in let%bind tv_opt = bind_fold_list aux None tvs in
let mt' = make_a_e let%bind tv =
(E_constant ("ASSERT_INFERRED" , [ex' ; fw'])) trace_option (match_empty_variant m ae.location) @@
(t_unit ()) tv_opt in
e return (O.E_matching (ex', m')) tv
in
let m' = O.Match_bool { match_true = mt' ; match_false = mf' } in
return (O.E_matching (ex' , m')) (t_unit ())
)
| _ -> (
let%bind m' = type_match (type_expression ?tv_opt:None) e ex'.type_annotation m ae ae.location in
let tvs =
let aux (cur:O.value O.matching) =
match cur with
| Match_bool { match_true ; match_false } -> [ match_true ; match_false ]
| Match_list { match_nil ; match_cons = ((_ , _) , match_cons) } -> [ match_nil ; match_cons ]
| Match_option { match_none ; match_some = (_ , match_some) } -> [ match_none ; match_some ]
| Match_tuple (_ , match_tuple) -> [ match_tuple ]
| Match_variant (lst , _) -> List.map snd lst in
List.map get_type_annotation @@ aux m' in
let aux prec cur =
let%bind () =
match prec with
| None -> ok ()
| Some cur' -> Ast_typed.assert_type_value_eq (cur , cur') in
ok (Some cur) in
let%bind tv_opt = bind_fold_list aux None tvs in
let%bind tv =
trace_option (match_empty_variant m ae.location) @@
tv_opt in
return (O.E_matching (ex', m')) tv
)
) )
| E_sequence (a , b) -> | E_sequence (a , b) ->
let%bind a' = type_expression e a in let%bind a' = type_expression e a in
@ -868,9 +840,6 @@ let rec untype_expression (e:O.annotated_expression) : (I.expression) result =
let%bind ae' = untype_expression ae in let%bind ae' = untype_expression ae in
let%bind m' = untype_matching untype_expression m in let%bind m' = untype_matching untype_expression m in
return (e_matching ae' m') return (e_matching ae' m')
| E_failwith ae ->
let%bind ae' = untype_expression ae in
return (e_failwith ae')
| E_sequence _ | E_sequence _
| E_loop _ | E_loop _
| E_assign _ -> fail @@ not_supported_yet_untranspile "not possible to untranspile statements yet" e.expression | E_assign _ -> fail @@ not_supported_yet_untranspile "not possible to untranspile statements yet" e.expression

View File

@ -131,28 +131,39 @@ let rec transpile_type (t:AST.type_value) : type_value result =
let%bind o' = transpile_type o in let%bind o' = transpile_type o in
ok (T_option o') ok (T_option o')
| T_constant (name , _lst) -> fail @@ unrecognized_type_constant name | T_constant (name , _lst) -> fail @@ unrecognized_type_constant name
(* TODO hmm *)
| T_sum m -> | T_sum m ->
let node = Append_tree.of_list @@ list_of_map m in let node = Append_tree.of_list @@ kv_list_of_map m in
let aux a b : type_value result = let aux a b : type_value annotated result =
let%bind a = a in let%bind a = a in
let%bind b = b in let%bind b = b in
ok (T_or (a, b)) ok (None, T_or (a, b))
in in
Append_tree.fold_ne transpile_type aux node let%bind m' = Append_tree.fold_ne
(fun (ann, a) ->
let%bind a = transpile_type a in
ok (Some (String.uncapitalize_ascii ann), a))
aux node in
ok @@ snd m'
| T_record m -> | T_record m ->
let node = Append_tree.of_list @@ list_of_map m in let node = Append_tree.of_list @@ kv_list_of_map m in
let aux a b : type_value result = let aux a b : type_value annotated result =
let%bind a = a in let%bind a = a in
let%bind b = b in let%bind b = b in
ok (T_pair (a, b)) ok (None, T_pair (a, b))
in in
Append_tree.fold_ne transpile_type aux node let%bind m' = Append_tree.fold_ne
(fun (ann, a) ->
let%bind a = transpile_type a in
ok (Some ann, a))
aux node in
ok @@ snd m'
| T_tuple lst -> | T_tuple lst ->
let node = Append_tree.of_list lst in let node = Append_tree.of_list lst in
let aux a b : type_value result = let aux a b : type_value result =
let%bind a = a in let%bind a = a in
let%bind b = b in let%bind b = b in
ok (T_pair (a, b)) ok (T_pair ((None, a), (None, b)))
in in
Append_tree.fold_ne transpile_type aux node Append_tree.fold_ne transpile_type aux node
| T_function (param, result) -> ( | T_function (param, result) -> (
@ -253,10 +264,6 @@ and transpile_annotated_expression (ae:AST.annotated_expression) : expression re
let%bind rhs' = transpile_annotated_expression rhs in let%bind rhs' = transpile_annotated_expression rhs in
let%bind result' = transpile_annotated_expression result in let%bind result' = transpile_annotated_expression result in
return (E_let_in ((binder, rhs'.type_value), rhs', result')) return (E_let_in ((binder, rhs'.type_value), rhs', result'))
| E_failwith ae -> (
let%bind ae' = transpile_annotated_expression ae in
return @@ E_constant ("FAILWITH" , [ae'])
)
| E_literal l -> return @@ E_literal (transpile_literal l) | E_literal l -> return @@ E_literal (transpile_literal l)
| E_variable name -> ( | E_variable name -> (
let%bind ele = let%bind ele =
@ -289,10 +296,10 @@ and transpile_annotated_expression (ae:AST.annotated_expression) : expression re
let%bind a = a in let%bind a = a in
let%bind b = b in let%bind b = b in
match (a, b) with match (a, b) with
| (None, a), (None, b) -> ok (None, T_or (a, b)) | (None, a), (None, b) -> ok (None, T_or ((None, a), (None, b)))
| (Some _, _), (Some _, _) -> fail @@ corner_case ~loc:__LOC__ "multiple identical constructors in the same variant" | (Some _, _), (Some _, _) -> fail @@ corner_case ~loc:__LOC__ "multiple identical constructors in the same variant"
| (Some v, a), (None, b) -> ok (Some (E_constant ("LEFT", [Combinators.Expression.make_tpl (v, a)])), T_or (a, b)) | (Some v, a), (None, b) -> ok (Some (E_constant ("LEFT", [Combinators.Expression.make_tpl (v, a)])), T_or ((None, a), (None, b)))
| (None, a), (Some v, b) -> ok (Some (E_constant ("RIGHT", [Combinators.Expression.make_tpl (v, b)])), T_or (a, b)) | (None, a), (Some v, b) -> ok (Some (E_constant ("RIGHT", [Combinators.Expression.make_tpl (v, b)])), T_or ((None, a), (None, b)))
in in
let%bind (ae_opt, tv) = Append_tree.fold_ne leaf node node_tv in let%bind (ae_opt, tv) = Append_tree.fold_ne leaf node node_tv in
let%bind ae = let%bind ae =
@ -307,7 +314,7 @@ and transpile_annotated_expression (ae:AST.annotated_expression) : expression re
let%bind b = b in let%bind b = b in
let a_ty = Combinators.Expression.get_type a in let a_ty = Combinators.Expression.get_type a in
let b_ty = Combinators.Expression.get_type b in let b_ty = Combinators.Expression.get_type b in
let tv = T_pair (a_ty , b_ty) in let tv = T_pair ((None, a_ty) , (None, b_ty)) in
return ~tv @@ E_constant ("PAIR", [a; b]) return ~tv @@ E_constant ("PAIR", [a; b])
in in
Append_tree.fold_ne (transpile_annotated_expression) aux node Append_tree.fold_ne (transpile_annotated_expression) aux node
@ -337,7 +344,7 @@ and transpile_annotated_expression (ae:AST.annotated_expression) : expression re
let%bind b = b in let%bind b = b in
let a_ty = Combinators.Expression.get_type a in let a_ty = Combinators.Expression.get_type a in
let b_ty = Combinators.Expression.get_type b in let b_ty = Combinators.Expression.get_type b in
let tv = T_pair (a_ty , b_ty) in let tv = T_pair ((None, a_ty) , (None, b_ty)) in
return ~tv @@ E_constant ("PAIR", [a; b]) return ~tv @@ E_constant ("PAIR", [a; b])
in in
trace_strong (corner_case ~loc:__LOC__ "record build") @@ trace_strong (corner_case ~loc:__LOC__ "record build") @@
@ -555,7 +562,7 @@ and transpile_annotated_expression (ae:AST.annotated_expression) : expression re
| Node {a ; b} -> | Node {a ; b} ->
let%bind a' = aux a in let%bind a' = aux a in
let%bind b' = aux b in let%bind b' = aux b in
let tv' = Mini_c.t_union (snd a') (snd b') in let tv' = Mini_c.t_union (None, snd a') (None, snd b') in
ok (`Node (a' , b') , tv') ok (`Node (a' , b') , tv')
in aux tree' in aux tree'
in in
@ -648,8 +655,8 @@ let check_storage f ty loc : (anon_function * _) result =
let rec aux (t:type_value) on_big_map = let rec aux (t:type_value) on_big_map =
match t with match t with
| T_big_map _ -> on_big_map | T_big_map _ -> on_big_map
| T_pair (a , b) -> (aux a true) && (aux b false) | T_pair (a , b) -> (aux (snd a) true) && (aux (snd b) false)
| T_or (a,b) -> (aux a false) && (aux b false) | T_or (a,b) -> (aux (snd a) false) && (aux (snd b) false)
| T_function (a,b) -> (aux a false) && (aux b false) | T_function (a,b) -> (aux a false) && (aux b false)
| T_deep_closure (_,a,b) -> (aux a false) && (aux b false) | T_deep_closure (_,a,b) -> (aux a false) && (aux b false)
| T_map (a,b) -> (aux a false) && (aux b false) | T_map (a,b) -> (aux a false) && (aux b false)
@ -661,7 +668,7 @@ let check_storage f ty loc : (anon_function * _) result =
in in
match f.body.type_value with match f.body.type_value with
| T_pair (_, storage) -> | T_pair (_, storage) ->
if aux storage false then ok (f, ty) else fail @@ bad_big_map loc if aux (snd storage) false then ok (f, ty) else fail @@ bad_big_map loc
| _ -> ok (f, ty) | _ -> ok (f, ty)
let extract_constructor (v : value) (tree : _ Append_tree.t') : (string * value * AST.type_value) result = let extract_constructor (v : value) (tree : _ Append_tree.t') : (string * value * AST.type_value) result =

View File

@ -43,6 +43,13 @@ module Ty = struct
let pair a b = Pair_t ((a, None, None), (b, None, None), None) let pair a b = Pair_t ((a, None, None), (b, None, None), None)
let union a b = Union_t ((a, None), (b, None), None) let union a b = Union_t ((a, None), (b, None), None)
let field_annot = Option.map (fun ann -> `Field_annot ann)
let union_ann (anna, a) (annb, b) =
Union_t ((a, field_annot anna), (b, field_annot annb), None)
let pair_ann (anna, a) (annb, b) =
Pair_t ((a, field_annot anna, None), (b, field_annot annb, None), None)
let not_comparable name () = error (thunk "not a comparable type") (fun () -> name) () let not_comparable name () = error (thunk "not a comparable type") (fun () -> name) ()
let not_compilable_type name () = error (thunk "not a compilable type") (fun () -> name) () let not_compilable_type name () = error (thunk "not a compilable type") (fun () -> name) ()
@ -95,14 +102,14 @@ module Ty = struct
function function
| T_base b -> base_type b | T_base b -> base_type b
| T_pair (t, t') -> ( | T_pair (t, t') -> (
type_ t >>? fun (Ex_ty t) -> annotated t >>? fun (ann, Ex_ty t) ->
type_ t' >>? fun (Ex_ty t') -> annotated t' >>? fun (ann', Ex_ty t') ->
ok @@ Ex_ty (pair t t') ok @@ Ex_ty (pair_ann (ann, t) (ann', t'))
) )
| T_or (t, t') -> ( | T_or (t, t') -> (
type_ t >>? fun (Ex_ty t) -> annotated t >>? fun (ann, Ex_ty t) ->
type_ t' >>? fun (Ex_ty t') -> annotated t' >>? fun (ann', Ex_ty t') ->
ok @@ Ex_ty (union t t') ok @@ Ex_ty (union_ann (ann, t) (ann', t'))
) )
| T_function (arg, ret) -> | T_function (arg, ret) ->
let%bind (Ex_ty arg) = type_ arg in let%bind (Ex_ty arg) = type_ arg in
@ -135,6 +142,10 @@ module Ty = struct
let%bind (Ex_ty t') = type_ t in let%bind (Ex_ty t') = type_ t in
ok @@ Ex_ty (contract t') ok @@ Ex_ty (contract t')
and annotated : type_value annotated -> ex_ty annotated result =
fun (ann, a) -> let%bind a = type_ a in
ok @@ (ann, a)
and environment_representation = fun e -> and environment_representation = fun e ->
match List.rev_uncons_opt e with match List.rev_uncons_opt e with
| None -> ok @@ Ex_ty unit | None -> ok @@ Ex_ty unit
@ -177,13 +188,13 @@ let rec type_ : type_value -> O.michelson result =
function function
| T_base b -> base_type b | T_base b -> base_type b
| T_pair (t, t') -> ( | T_pair (t, t') -> (
type_ t >>? fun t -> annotated t >>? fun t ->
type_ t' >>? fun t' -> annotated t' >>? fun t' ->
ok @@ O.prim ~children:[t;t'] O.T_pair ok @@ O.prim ~children:[t;t'] O.T_pair
) )
| T_or (t, t') -> ( | T_or (t, t') -> (
type_ t >>? fun t -> annotated t >>? fun t ->
type_ t' >>? fun t' -> annotated t' >>? fun t' ->
ok @@ O.prim ~children:[t;t'] O.T_or ok @@ O.prim ~children:[t;t'] O.T_or
) )
| T_map kv -> | T_map kv ->
@ -213,6 +224,13 @@ let rec type_ : type_value -> O.michelson result =
let%bind lambda = lambda_closure (c , arg , ret) in let%bind lambda = lambda_closure (c , arg , ret) in
ok @@ O.t_pair lambda capture ok @@ O.t_pair lambda capture
and annotated : type_value annotated -> O.michelson result =
function
| (Some ann, o) ->
let%bind o' = type_ o in
ok (O.annotate ("%" ^ ann) o')
| (None, o) -> type_ o
and environment_element (name, tyv) = and environment_element (name, tyv) =
let%bind michelson_type = type_ tyv in let%bind michelson_type = type_ tyv in
ok @@ O.annotate ("@" ^ name) michelson_type ok @@ O.annotate ("@" ^ name) michelson_type

View File

@ -312,11 +312,12 @@ module Typer = struct
then ok @@ t_bytes () then ok @@ t_bytes ()
else simple_fail "bad slice" else simple_fail "bad slice"
let failwith_ = typer_1 "FAILWITH" @@ fun t -> let failwith_ = typer_1_opt "FAILWITH" @@ fun t opt ->
let%bind () = let%bind () =
Assert.assert_true @@ Assert.assert_true @@
(is_t_string t) in (is_t_string t) in
ok @@ t_unit () let default = t_unit () in
ok @@ Simple_utils.Option.unopt ~default opt
let map_get_force = typer_2 "MAP_GET_FORCE" @@ fun i m -> let map_get_force = typer_2 "MAP_GET_FORCE" @@ fun i m ->
let%bind (src, dst) = bind_map_or (get_t_map , get_t_big_map) m in let%bind (src, dst) = bind_map_or (get_t_map , get_t_big_map) m in

View File

@ -52,8 +52,6 @@ let rec expression ppf (e:expression) = match e.expression with
expression result expression result
| E_matching (ae, m) -> | E_matching (ae, m) ->
fprintf ppf "match %a with %a" expression ae (matching expression) m fprintf ppf "match %a with %a" expression ae (matching expression) m
| E_failwith ae ->
fprintf ppf "failwith %a" expression ae
| E_sequence (a , b) -> | E_sequence (a , b) ->
fprintf ppf "%a ; %a" fprintf ppf "%a ; %a"
expression a expression a

View File

@ -84,7 +84,6 @@ let e_matching_bool ?loc a b c : expression = e_matching ?loc a (Match_bool {mat
let e_accessor ?loc a b = location_wrap ?loc @@ E_accessor (a , b) let e_accessor ?loc a b = location_wrap ?loc @@ E_accessor (a , b)
let e_accessor_props ?loc a b = e_accessor ?loc a (List.map (fun x -> Access_record x) b) let e_accessor_props ?loc a b = e_accessor ?loc a (List.map (fun x -> Access_record x) b)
let e_variable ?loc v = location_wrap ?loc @@ E_variable v let e_variable ?loc v = location_wrap ?loc @@ E_variable v
let e_failwith ?loc v = location_wrap ?loc @@ E_failwith v
let e_skip ?loc () = location_wrap ?loc @@ E_skip let e_skip ?loc () = location_wrap ?loc @@ E_skip
let e_loop ?loc cond body = location_wrap ?loc @@ E_loop (cond , body) let e_loop ?loc cond body = location_wrap ?loc @@ E_loop (cond , body)
let e_sequence ?loc a b = location_wrap ?loc @@ E_sequence (a , b) let e_sequence ?loc a b = location_wrap ?loc @@ E_sequence (a , b)
@ -167,13 +166,6 @@ let get_e_tuple = fun t ->
| E_tuple lst -> ok lst | E_tuple lst -> ok lst
| _ -> simple_fail "not a tuple" | _ -> simple_fail "not a tuple"
let get_e_failwith = fun e ->
match e.expression with
| E_failwith fw -> ok fw
| _ -> simple_fail "not a failwith"
let is_e_failwith e = to_bool @@ get_e_failwith e
let extract_pair : expression -> (expression * expression) result = fun e -> let extract_pair : expression -> (expression * expression) result = fun e ->
match e.expression with match e.expression with
| E_tuple [ a ; b ] -> ok (a , b) | E_tuple [ a ; b ] -> ok (a , b)

View File

@ -163,7 +163,7 @@ let rec assert_value_eq (a, b: (expression * expression )) : unit result =
| (E_variable _, _) | (E_lambda _, _) | (E_variable _, _) | (E_lambda _, _)
| (E_application _, _) | (E_let_in _, _) | (E_application _, _) | (E_let_in _, _)
| (E_accessor _, _) | (E_accessor _, _)
| (E_look_up _, _) | (E_matching _, _) | (E_failwith _, _) | (E_sequence _, _) | (E_look_up _, _) | (E_matching _, _) | (E_sequence _, _)
| (E_loop _, _) | (E_assign _, _) | (E_skip, _) -> simple_fail "comparing not a value" | (E_loop _, _) | (E_assign _, _) | (E_skip, _) -> simple_fail "comparing not a value"
let is_value_eq (a , b) = to_bool @@ assert_value_eq (a , b) let is_value_eq (a , b) = to_bool @@ assert_value_eq (a , b)

View File

@ -65,7 +65,6 @@ and expression' =
| E_look_up of (expr * expr) | E_look_up of (expr * expr)
(* Matching *) (* Matching *)
| E_matching of (expr * matching_expr) | E_matching of (expr * matching_expr)
| E_failwith of expr
(* Replace Statements *) (* Replace Statements *)
| E_sequence of (expr * expr) | E_sequence of (expr * expr)
| E_loop of (expr * expr) | E_loop of (expr * expr)

View File

@ -47,7 +47,6 @@ and expression ppf (e:expression) : unit =
| E_look_up (ds, i) -> fprintf ppf "(%a)[%a]" annotated_expression ds annotated_expression i | E_look_up (ds, i) -> fprintf ppf "(%a)[%a]" annotated_expression ds annotated_expression i
| E_matching (ae, m) -> | E_matching (ae, m) ->
fprintf ppf "match %a with %a" annotated_expression ae (matching annotated_expression) m fprintf ppf "match %a with %a" annotated_expression ae (matching annotated_expression) m
| E_failwith ae -> fprintf ppf "failwith %a" annotated_expression ae
| E_sequence (a , b) -> fprintf ppf "%a ; %a" annotated_expression a annotated_expression b | E_sequence (a , b) -> fprintf ppf "%a ; %a" annotated_expression a annotated_expression b
| E_loop (expr , body) -> fprintf ppf "while %a { %a }" annotated_expression expr annotated_expression body | E_loop (expr , body) -> fprintf ppf "while %a { %a }" annotated_expression expr annotated_expression body
| E_assign (name , path , expr) -> | E_assign (name , path , expr) ->

View File

@ -176,7 +176,6 @@ module Free_variables = struct
| (E_map m | E_big_map m) -> unions @@ List.map self @@ List.concat @@ List.map (fun (a, b) -> [ a ; b ]) m | (E_map m | E_big_map m) -> unions @@ List.map self @@ List.concat @@ List.map (fun (a, b) -> [ a ; b ]) m
| E_look_up (a , b) -> unions @@ List.map self [ a ; b ] | E_look_up (a , b) -> unions @@ List.map self [ a ; b ]
| E_matching (a , cs) -> union (self a) (matching_expression b cs) | E_matching (a , cs) -> union (self a) (matching_expression b cs)
| E_failwith a -> self a
| E_sequence (a , b) -> unions @@ List.map self [ a ; b ] | E_sequence (a , b) -> unions @@ List.map self [ a ; b ]
| E_loop (expr , body) -> unions @@ List.map self [ expr ; body ] | E_loop (expr , body) -> unions @@ List.map self [ expr ; body ]
| E_assign (_ , _ , expr) -> self expr | E_assign (_ , _ , expr) -> self expr
@ -476,7 +475,7 @@ let rec assert_value_eq (a, b: (value*value)) : unit result =
| (E_literal _, _) | (E_variable _, _) | (E_application _, _) | (E_literal _, _) | (E_variable _, _) | (E_application _, _)
| (E_lambda _, _) | (E_let_in _, _) | (E_tuple_accessor _, _) | (E_lambda _, _) | (E_let_in _, _) | (E_tuple_accessor _, _)
| (E_record_accessor _, _) | (E_record_accessor _, _)
| (E_look_up _, _) | (E_matching _, _) | (E_failwith _, _) | (E_look_up _, _) | (E_matching _, _)
| (E_assign _ , _) | (E_assign _ , _)
| (E_sequence _, _) | (E_loop _, _)-> fail @@ error_uncomparable_values "can't compare sequences nor loops" a b | (E_sequence _, _) | (E_loop _, _)-> fail @@ error_uncomparable_values "can't compare sequences nor loops" a b

View File

@ -88,7 +88,6 @@ module Captured_variables = struct
let%bind a' = self a in let%bind a' = self a in
let%bind cs' = matching_expression b cs in let%bind cs' = matching_expression b cs in
ok @@ union a' cs' ok @@ union a' cs'
| E_failwith a -> self a
| E_sequence (_ , b) -> self b | E_sequence (_ , b) -> self b
| E_loop (expr , body) -> | E_loop (expr , body) ->
let%bind lst' = bind_map_list self [ expr ; body ] in let%bind lst' = bind_map_list self [ expr ; body ] in

View File

@ -105,7 +105,6 @@ and expression =
| E_look_up of (ae * ae) | E_look_up of (ae * ae)
(* Advanced *) (* Advanced *)
| E_matching of (ae * matching_expr) | E_matching of (ae * matching_expr)
| E_failwith of ae
(* Replace Statements *) (* Replace Statements *)
| E_sequence of (ae * ae) | E_sequence of (ae * ae)
| E_loop of (ae * ae) | E_loop of (ae * ae)

View File

@ -22,8 +22,8 @@ let type_base ppf : type_base -> _ = function
| Base_operation -> fprintf ppf "operation" | Base_operation -> fprintf ppf "operation"
let rec type_ ppf : type_value -> _ = function let rec type_ ppf : type_value -> _ = function
| T_or(a, b) -> fprintf ppf "(%a) | (%a)" type_ a type_ b | T_or(a, b) -> fprintf ppf "(%a) | (%a)" annotated a annotated b
| T_pair(a, b) -> fprintf ppf "(%a) & (%a)" type_ a type_ b | T_pair(a, b) -> fprintf ppf "(%a) & (%a)" annotated a annotated b
| T_base b -> type_base ppf b | T_base b -> type_base ppf b
| T_function(a, b) -> fprintf ppf "(%a) -> (%a)" type_ a type_ b | T_function(a, b) -> fprintf ppf "(%a) -> (%a)" type_ a type_ b
| T_map(k, v) -> fprintf ppf "map(%a -> %a)" type_ k type_ v | T_map(k, v) -> fprintf ppf "map(%a -> %a)" type_ k type_ v
@ -37,6 +37,10 @@ let rec type_ ppf : type_value -> _ = function
environment c environment c
type_ arg type_ ret type_ arg type_ ret
and annotated ppf : type_value annotated -> _ = function
| (Some ann, a) -> fprintf ppf "(%a %%%s)" type_ a ann
| (None, a) -> type_ ppf a
and environment_element ppf ((s, tv) : environment_element) = and environment_element ppf ((s, tv) : environment_element) =
Format.fprintf ppf "%s : %a" s type_ tv Format.fprintf ppf "%s : %a" s type_ tv

View File

@ -102,11 +102,11 @@ let get_pair (v:value) = match v with
| _ -> simple_fail "not a pair" | _ -> simple_fail "not a pair"
let get_t_pair (t:type_value) = match t with let get_t_pair (t:type_value) = match t with
| T_pair (a, b) -> ok (a, b) | T_pair ((_, a), (_, b)) -> ok (a, b)
| _ -> simple_fail "not a type pair" | _ -> simple_fail "not a type pair"
let get_t_or (t:type_value) = match t with let get_t_or (t:type_value) = match t with
| T_or (a, b) -> ok (a, b) | T_or ((_, a), (_, b)) -> ok (a, b)
| _ -> simple_fail "not a type or" | _ -> simple_fail "not a type or"
let get_t_map (t:type_value) = match t with let get_t_map (t:type_value) = match t with
@ -144,11 +144,11 @@ let wrong_type name t =
error title content error title content
let get_t_left t = match t with let get_t_left t = match t with
| T_or (a , _) -> ok a | T_or ((_, a) , _) -> ok a
| _ -> fail @@ wrong_type "union" t | _ -> fail @@ wrong_type "union" t
let get_t_right t = match t with let get_t_right t = match t with
| T_or (_ , b) -> ok b | T_or (_ , (_, b)) -> ok b
| _ -> fail @@ wrong_type "union" t | _ -> fail @@ wrong_type "union" t
let get_t_contract t = match t with let get_t_contract t = match t with

View File

@ -8,9 +8,11 @@ type type_base =
| Base_string | Base_bytes | Base_address | Base_string | Base_bytes | Base_address
| Base_operation | Base_operation
type 'a annotated = string option * 'a
type type_value = type type_value =
| T_pair of (type_value * type_value) | T_pair of (type_value annotated * type_value annotated)
| T_or of type_value * type_value | T_or of (type_value annotated * type_value annotated)
| T_function of (type_value * type_value) | T_function of (type_value * type_value)
| T_deep_closure of (environment * type_value * type_value) | T_deep_closure of (environment * type_value * type_value)
| T_base of type_base | T_base of type_base

View File

@ -41,7 +41,7 @@ function transfer_single(const action : action_transfer_single ; const s : stora
begin begin
const cards : cards = s.cards ; const cards : cards = s.cards ;
const card : card = get_force(action.card_to_transfer , cards) ; const card : card = get_force(action.card_to_transfer , cards) ;
if (card.card_owner =/= source) then fail "This card doesn't belong to you" else skip ; if (card.card_owner =/= source) then failwith ("This card doesn't belong to you") else skip ;
card.card_owner := action.destination ; card.card_owner := action.destination ;
cards[action.card_to_transfer] := card ; cards[action.card_to_transfer] := card ;
s.cards := cards ; s.cards := cards ;
@ -51,7 +51,7 @@ function transfer_single(const action : action_transfer_single ; const s : stora
function sell_single(const action : action_sell_single ; const s : storage_type) : (list(operation) * storage_type) is function sell_single(const action : action_sell_single ; const s : storage_type) : (list(operation) * storage_type) is
begin begin
const card : card = get_force(action.card_to_sell , s.cards) ; const card : card = get_force(action.card_to_sell , s.cards) ;
if (card.card_owner =/= source) then fail "This card doesn't belong to you" else skip ; if (card.card_owner =/= source) then failwith ("This card doesn't belong to you") else skip ;
const card_pattern : card_pattern = get_force(card.card_pattern , s.card_patterns) ; const card_pattern : card_pattern = get_force(card.card_pattern , s.card_patterns) ;
card_pattern.quantity := abs(card_pattern.quantity - 1n); card_pattern.quantity := abs(card_pattern.quantity - 1n);
const card_patterns : card_patterns = s.card_patterns ; const card_patterns : card_patterns = s.card_patterns ;
@ -71,7 +71,7 @@ function buy_single(const action : action_buy_single ; const s : storage_type) :
// Check funds // Check funds
const card_pattern : card_pattern = get_force(action.card_to_buy , s.card_patterns) ; const card_pattern : card_pattern = get_force(action.card_to_buy , s.card_patterns) ;
const price : tez = card_pattern.coefficient * (card_pattern.quantity + 1n) ; const price : tez = card_pattern.coefficient * (card_pattern.quantity + 1n) ;
if (price > amount) then fail "Not enough money" else skip ; if (price > amount) then failwith ("Not enough money") else skip ;
// Administrative procedure // Administrative procedure
const operations : list(operation) = nil ; const operations : list(operation) = nil ;
// Increase quantity // Increase quantity

View File

@ -10,3 +10,24 @@ function main (const p : param; const s : unit) : list(operation) * unit is
end end
} }
with ((nil : list(operation)), s) with ((nil : list(operation)), s)
function foobar (const i : int) : int is
var p : param := Zero (42n) ;
block {
if i > 0 then block {
i := i + 1 ;
if i > 10 then block {
i := 20 ;
failwith ("who knows") ;
i := 30 ;
} else skip
} else block {
case p of
| Zero (n) -> failwith ("wooo")
| Pos (n) -> skip
end
}
} with case p of
| Zero (n) -> i
| Pos (n) -> (failwith ("waaaa") : int)
end

View File

@ -0,0 +1,4 @@
const add_tez : tez = 21mtz + 21mtz;
const sub_tez : tez = 21mtz - 20mtz;
(* is this enough? *)
const not_enough_tez : tez = 4611686018427387903mtz;

View File

@ -0,0 +1,5 @@
let add_tez : tez = 0.000021tz + 0.000021tz
let sub_tez : tez = 0.000021tz - 0.000020tz
let not_enough_tez : tez = 4611686018427.387903tz
let add_more_tez : tez = 100tz + 10tz + 1tz + 0.1tz + 0.01tz + 0.001tz

View File

@ -670,6 +670,11 @@ let failwith_ligo () : unit result =
let%bind _ = should_fail (e_pair (e_constructor "Zero" (e_nat 1)) (e_unit ())) in let%bind _ = should_fail (e_pair (e_constructor "Zero" (e_nat 1)) (e_unit ())) in
let%bind _ = should_work (e_pair (e_constructor "Pos" (e_nat 1)) (e_unit ())) in let%bind _ = should_work (e_pair (e_constructor "Pos" (e_nat 1)) (e_unit ())) in
let%bind _ = should_fail (e_pair (e_constructor "Pos" (e_nat 0)) (e_unit ())) in let%bind _ = should_fail (e_pair (e_constructor "Pos" (e_nat 0)) (e_unit ())) in
let should_fail input = expect_fail program "foobar" (e_int input) in
let should_work input n = expect_eq program "foobar" (e_int input) (e_int n) in
let%bind () = should_fail 10 in
let%bind () = should_fail @@ -10 in
let%bind () = should_work 5 6 in
ok () ok ()
let failwith_mligo () : unit result = let failwith_mligo () : unit result =
@ -698,7 +703,7 @@ let guess_string_mligo () : unit result =
in expect_eq_n program "main" make_input make_expected in expect_eq_n program "main" make_input make_expected
let basic_mligo () : unit result = let basic_mligo () : unit result =
let%bind typed = mtype_file ~debug_simplify:true "./contracts/basic.mligo" in let%bind typed = mtype_file "./contracts/basic.mligo" in
let%bind result = Run.Of_typed.evaluate_entry typed "foo" in let%bind result = Run.Of_typed.evaluate_entry typed "foo" in
Ast_typed.assert_value_eq Ast_typed.assert_value_eq
(Ast_typed.Combinators.e_a_empty_int (42 + 127), result) (Ast_typed.Combinators.e_a_empty_int (42 + 127), result)
@ -787,6 +792,21 @@ let website2_ligo () : unit result =
e_pair (e_typed_list [] t_operation) (e_int (op 42 n)) in e_pair (e_typed_list [] t_operation) (e_int (op 42 n)) in
expect_eq_n program "main" make_input make_expected expect_eq_n program "main" make_input make_expected
let tez_ligo () : unit result =
let%bind program = type_file "./contracts/tez.ligo" in
let%bind _ = expect_eq_evaluate program "add_tez" (e_mutez 42) in
let%bind _ = expect_eq_evaluate program "sub_tez" (e_mutez 1) in
let%bind _ = expect_eq_evaluate program "not_enough_tez" (e_mutez 4611686018427387903) in
ok ()
let tez_mligo () : unit result =
let%bind program = mtype_file "./contracts/tez.mligo" in
let%bind _ = expect_eq_evaluate program "add_tez" (e_mutez 42) in
let%bind _ = expect_eq_evaluate program "sub_tez" (e_mutez 1) in
let%bind _ = expect_eq_evaluate program "not_enough_tez" (e_mutez 4611686018427387903) in
let%bind _ = expect_eq_evaluate program "add_more_tez" (e_mutez 111111000) in
ok ()
let main = test_suite "Integration (End to End)" [ let main = test_suite "Integration (End to End)" [
test "type alias" type_alias ; test "type alias" type_alias ;
test "function" function_ ; test "function" function_ ;
@ -844,6 +864,8 @@ let main = test_suite "Integration (End to End)" [
test "lambda mligo" lambda_mligo ; test "lambda mligo" lambda_mligo ;
test "lambda ligo" lambda_ligo ; test "lambda ligo" lambda_ligo ;
(* test "lambda2 mligo" lambda2_mligo ; *) (* test "lambda2 mligo" lambda2_mligo ; *)
test "tez (ligo)" tez_ligo ;
test "tez (mligo)" tez_mligo ;
test "website1 ligo" website1_ligo ; test "website1 ligo" website1_ligo ;
test "website2 ligo" website2_ligo ; test "website2 ligo" website2_ligo ;
] ]

View File

@ -953,8 +953,6 @@ let parse_michelson (type aft)
?type_logger ?type_logger
(bef:'a Script_typed_ir.stack_ty) (aft:aft Script_typed_ir.stack_ty) (bef:'a Script_typed_ir.stack_ty) (aft:aft Script_typed_ir.stack_ty)
= =
let michelson = Michelson.strip_annots michelson in
let michelson = Michelson.strip_nops michelson in
parse_instr parse_instr
?type_logger ?type_logger
top_level tezos_context top_level tezos_context
@ -975,8 +973,6 @@ let parse_michelson_fail (type aft)
?type_logger ?type_logger
(bef:'a Script_typed_ir.stack_ty) (aft:aft Script_typed_ir.stack_ty) (bef:'a Script_typed_ir.stack_ty) (aft:aft Script_typed_ir.stack_ty)
= =
let michelson = Michelson.strip_annots michelson in
let michelson = Michelson.strip_nops michelson in
parse_instr parse_instr
?type_logger ?type_logger
top_level tezos_context top_level tezos_context
@ -995,8 +991,6 @@ let parse_michelson_fail (type aft)
let parse_michelson_data let parse_michelson_data
?(tezos_context = dummy_environment.tezos_context) ?(tezos_context = dummy_environment.tezos_context)
michelson ty = michelson ty =
let michelson = Michelson.strip_annots michelson in
let michelson = Michelson.strip_nops michelson in
parse_data tezos_context ty michelson >>=?? fun (data, _) -> parse_data tezos_context ty michelson >>=?? fun (data, _) ->
return data return data
@ -1004,8 +998,6 @@ let parse_michelson_ty
?(tezos_context = dummy_environment.tezos_context) ?(tezos_context = dummy_environment.tezos_context)
?(allow_big_map = true) ?(allow_operation = true) ?(allow_big_map = true) ?(allow_operation = true)
michelson = michelson =
let michelson = Michelson.strip_annots michelson in
let michelson = Michelson.strip_nops michelson in
Lwt.return @@ parse_ty tezos_context ~allow_big_map ~allow_operation michelson >>=?? fun (ty, _) -> Lwt.return @@ parse_ty tezos_context ~allow_big_map ~allow_operation michelson >>=?? fun (ty, _) ->
return ty return ty

View File

@ -75,12 +75,6 @@ let rec strip_annots : michelson -> michelson = function
| Prim (l, p, lst, _) -> Prim (l, p, List.map strip_annots lst, []) | Prim (l, p, lst, _) -> Prim (l, p, List.map strip_annots lst, [])
| x -> x | x -> x
let rec strip_nops : michelson -> michelson = function
| Seq(l, [Prim (_, I_UNIT, _, _) ; Prim(_, I_DROP, _, _)]) -> Seq (l, [])
| Seq(l, s) -> Seq(l, List.map strip_nops s)
| Prim (l, p, lst, a) -> Prim (l, p, List.map strip_nops lst, a)
| x -> x
let pp ppf (michelson:michelson) = let pp ppf (michelson:michelson) =
let open Micheline_printer in let open Micheline_printer in
let canonical = strip_locations michelson in let canonical = strip_locations michelson in
@ -98,15 +92,3 @@ let pp_json ppf (michelson : michelson) =
) )
in in
Format.fprintf ppf "%a" Tezos_data_encoding.Json.pp json Format.fprintf ppf "%a" Tezos_data_encoding.Json.pp json
let pp_stripped ppf (michelson:michelson) =
let open Micheline_printer in
let michelson' = strip_nops @@ strip_annots michelson in
let canonical = strip_locations michelson' in
let node = printable string_of_prim canonical in
print_expr ppf node
let pp_naked ppf m =
let naked = strip_annots m in
pp ppf naked