Code Monkey home page Code Monkey logo

pictorial's Introduction

Pictorial

Pictorial is a simple domain specific language that compiles to Scalable Vector Graphics, SVG format. Its simple and expressive.

Samples

Program structure

    - Compiler Directives

    - Program statements

Example Head made with shapes

#use <svg> /* Tells pictorial to compile to SVG */
#doc_width 300 /* Sets the pictures width */
#doc_height 300 /* Sets the pictures height */

circle 150 130 75 green 0 brown /* Head */
circle 80 70 30 black 0 black /* left ear */
circle 220 70 30 black 0 black /* right ear */
circle 120 110 15 black 5 white /* left eye */
circle 180 110 15 black 5 white /* right eye */
circle 150 140 10 black 0 black /* nose */
line 135 175 165 175 yellow 20

Output:

head

Syntax

An overview of the language's elements

#use

This tells the compiler what format to use and compile to.

#use <svg>

#doc_width

This sets the width of the final picture.

#doc_width value

#doc_height

This sets the height of the final picture.

#doc_height value

line

This is a pictorial language construct that corresponds to an SVG line element. Values passed to it are used for the SVG line element attributes.

line x1 y1 x2 y2 stroke-color stroke-width

text

This is also is a language construct that produces a SVG text element. Values passed to it are passed to the corresponding SVG text element as attributes.

text x y value

circle

Yet another language construct that represents an SVG circle element. Like every other construct of this kind values passed to it are passed to its corresponding SVG circle element as attributes.

circle x y r stroke-color stroke-width fill

rect

This construct will add an SVG rectangle to resultant svg.

rect x y width height fill

License

Serve-JS is MIT licensed

Copyright 2021 Spiff Jekey-Green [email protected]

Made with โค๏ธ in Nigeria ๐Ÿ‡ณ๐Ÿ‡ฌ

pictorial's People

Contributors

spiffgreen avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.