Skip to content

StrykerKKD/attribute-grammar-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Attribute Grammar Example

This project implements a simple attribute grammar, which converts floating point binary number into a decimal one.

The project is written in Reason.

Grammar:

  1. S -> N1 . N2

    • S.v := N1.v + N2.v
    • N1.r := 0
    • N2.r := -N2.l
  2. N -> N'B

    • N.v := N'.v + B.v
    • N.l := N'.l + 1
    • N'.r := N.r + 1 (N1 case)
    • N.r := -N.l (N2 case)
    • B.r := N.r
  3. N -> Lambda

    • N.v := 0
    • N.l := 0
  4. B -> One

    • B.v := 2 B.r
  5. B -> Zero

    • B.v := 0

How to use:

The project is sandboxed which means that it has a lot of dependecies, so the installed project size is around 3.2 GB.

I recommend using yarn for the project, but it can be used with npm as well(see Readme-npm).

git clone https://github.com/StrykerKKD/attribute-grammar-example.git
cd attribute-grammar-example
yarn cache clean
yarn install
yarn build
yarn start

Editor:

I mostly used visual studio code with the Reason extension, but you can use other editors(see Readme-Yarn).

About

Simple attribute grammar example in Reason

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages