Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running expr example #1

Closed
capitanjacksparrow opened this issue Feb 9, 2018 · 3 comments
Closed

Running expr example #1

capitanjacksparrow opened this issue Feb 9, 2018 · 3 comments
Assignees

Comments

@capitanjacksparrow
Copy link

Hi, i tried to run the expo example by lunching the Makefile, but i got the following errors in output:

mkdir -p ../../bin && clang ../../src/citron.c -o ../../bin/citron
../../bin/citron ArithmeticExpressionParser.y -o ArithmeticExpressionParser.swift
swiftc ../../src/CitronParser.swift ../../src/CitronLexer.swift ArithmeticExpressionParser.swift main.swift -o expr
../../src/CitronParser.swift:56:54: error: 'where' clause cannot be attached to an associated type declaration
associatedtype CitronTokenCode: RawRepresentable where CitronTokenCode.RawValue == CitronSymbolCode
^
../../src/CitronParser.swift:399:14: error: expected '(' for subscript parameters
subscript<I: BinaryInteger>(safe i: I) -> Element? {
^
../../src/CitronParser.swift:399:14: error: expected declaration
subscript<I: BinaryInteger>(safe i: I) -> Element? {
^
../../src/CitronParser.swift:398:9: note: in extension of 'Array'
private extension Array {
^
../../src/CitronParser.swift:50:38: error: use of undeclared type 'BinaryInteger'
associatedtype CitronSymbolCode: BinaryInteger // YYCODETYPE in lemon
^~~~~~~~~~~~~
../../src/CitronParser.swift:51:39: error: use of undeclared type 'BinaryInteger'
associatedtype CitronStateNumber: BinaryInteger
^~~~~~~~~~~~~
../../src/CitronParser.swift:52:38: error: use of undeclared type 'BinaryInteger'
associatedtype CitronRuleNumber: BinaryInteger
^~~~~~~~~~~~~
../../src/CitronParser.swift:139:40: error: use of undeclared type 'BinaryInteger'
enum _CitronParsingAction<StateNumber: BinaryInteger, RuleNumber: BinaryInteger> {
^~~~~~~~~~~~~
../../src/CitronParser.swift:139:67: error: use of undeclared type 'BinaryInteger'
enum _CitronParsingAction<StateNumber: BinaryInteger, RuleNumber: BinaryInteger> {
^~~~~~~~~~~~~
../../src/CitronParser.swift:149:38: error: use of undeclared type 'BinaryInteger'
enum _CitronStateOrRule<StateNumber: BinaryInteger, RuleNumber: BinaryInteger> {
^~~~~~~~~~~~~
../../src/CitronParser.swift:149:65: error: use of undeclared type 'BinaryInteger'
enum _CitronStateOrRule<StateNumber: BinaryInteger, RuleNumber: BinaryInteger> {
^~~~~~~~~~~~~
../../src/CitronParser.swift:159:30: error: cannot invoke 'symbolNameFor' with an argument list of type '(code: Self.CitronTokenCode.RawValue)'
tracePrint("Input:", symbolNameFor(code:symbolCode))
^
../../src/CitronParser.swift:159:30: note: expected an argument list of type '(code: Self.CitronSymbolCode)'
tracePrint("Input:", symbolNameFor(code:symbolCode))
^
../../src/CitronParser.swift:161:26: error: cannot invoke 'yyFindShiftAction' with an argument list of type '(lookAhead: Self.CitronTokenCode.RawValue)'
let action = yyFindShiftAction(lookAhead: symbolCode)
^
../../src/CitronParser.swift:161:26: note: expected an argument list of type '(lookAhead: Self.CitronSymbolCode)'
let action = yyFindShiftAction(lookAhead: symbolCode)
^
../../src/CitronParser.swift:185:26: error: cannot invoke 'yyFindShiftAction' with an argument list of type '(lookAhead: Int)'
let action = yyFindShiftAction(lookAhead: 0)
^
../../src/CitronParser.swift:185:26: note: expected an argument list of type '(lookAhead: Self.CitronSymbolCode)'
let action = yyFindShiftAction(lookAhead: 0)
^
../../src/CitronParser.swift:250:20: error: cannot invoke initializer for type 'Int' with an argument list of type '(Self.CitronStateNumber)'
assert(Int(state) < yyShiftOffset.count)
^
../../src/CitronParser.swift:250:20: note: overloads for 'Int' exist with these partially matching parameter lists: (Int64), (Word), (UInt8), (Int8), (UInt16), (Int16), (UInt32), (Int32), (UInt64), (UInt), (Int), (Float), (Double), (Float80), (String, radix: Int), (CGFloat), (NSNumber)
assert(Int(state) < yyShiftOffset.count)
^
../../src/CitronParser.swift:251:30: error: binary operator '<' cannot be applied to operands of type 'Self.CitronSymbolCode' and 'Int'
assert(lookAhead < yyNumberOfSymbols)
~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
../../src/CitronParser.swift:251:30: note: expected an argument list of type '(Int, Int)'
assert(lookAhead < yyNumberOfSymbols)
^
../../src/CitronParser.swift:252:31: error: cannot invoke initializer for type 'Int' with an argument list of type '(Self.CitronStateNumber)'
i = yyShiftOffset[Int(state)] + Int(lookAhead)
^
../../src/CitronParser.swift:252:31: note: overloads for 'Int' exist with these partially matching parameter lists: (Int64), (Word), (UInt8), (Int8), (UInt16), (Int16), (UInt32), (Int32), (UInt64), (UInt), (Int), (Float), (Double), (Float80), (String, radix: Int), (CGFloat), (NSNumber)
i = yyShiftOffset[Int(state)] + Int(lookAhead)
^
../../src/CitronParser.swift:254:74: error: binary operator '!=' cannot be applied to two 'Self.CitronSymbolCode' operands
if (i < 0 || i >= yyLookaheadAction.count || actionLookahead != lookAhead) {
~~~~~~~~~~~~~~~ ^ ~~~~~~~~~
../../src/CitronParser.swift:254:74: note: overloads for '!=' exist with these partially matching parameter lists: (Any.Type?, Any.Type?), (UInt8, UInt8), (Int8, Int8), (UInt16, UInt16), (Int16, Int16), (UInt32, UInt32), (Int32, Int32), (UInt64, UInt64), (Int64, Int64), (UInt, UInt), (Int, Int), (ContiguousArray, ContiguousArray), (ArraySlice, ArraySlice), (Array, Array), (T?, T?), (T?, _OptionalNilComparisonType), (_OptionalNilComparisonType, T?), ((A, B), (A, B)), ((A, B, C), (A, B, C)), ((A, B, C, D), (A, B, C, D)), ((A, B, C, D, E), (A, B, C, D, E)), ((A, B, C, D, E, F), (A, B, C, D, E, F)), (LazyFilterIndex, LazyFilterIndex), ([Key : Value], [Key : Value])
if (i < 0 || i >= yyLookaheadAction.count || actionLookahead != lookAhead) {
^
../../src/CitronParser.swift:256:45: error: cannot subscript a value of type '[Self.CitronSymbolCode]' with an index of type '(safe: Self.CitronSymbolCode)'
if let fallback = yyFallback[safe: lookAhead], fallback > 0 {
^
../../src/CitronParser.swift:256:45: note: overloads for 'subscript' exist with these partially matching parameter lists: (Int), (Range), (Range<Self.Index>), (ClosedRange<Self.Index>), (CountableRange<Self.Index>), (CountableClosedRange<Self.Index>)
if let fallback = yyFallback[safe: lookAhead], fallback > 0 {
^
../../src/CitronParser.swift:265:33: error: cannot invoke initializer for type 'Int' with an argument list of type '(Self.CitronSymbolCode)'
let j = i - Int(lookAhead) + Int(wildcard)
^
../../src/CitronParser.swift:265:33: note: overloads for 'Int' exist with these partially matching parameter lists: (Int64), (Word), (UInt8), (Int8), (UInt16), (Int16), (UInt32), (Int32), (UInt64), (UInt), (Int), (Float), (Double), (Float80), (String, radix: Int), (CGFloat), (NSNumber)
let j = i - Int(lookAhead) + Int(wildcard)
^
../../src/CitronParser.swift:275:40: error: cannot invoke initializer for type 'Int' with an argument list of type '(Self.CitronStateNumber)'
return yyDefaultAction[Int(state)]
^
../../src/CitronParser.swift:275:40: note: overloads for 'Int' exist with these partially matching parameter lists: (Int64), (Word), (UInt8), (Int8), (UInt16), (Int16), (UInt32), (Int32), (UInt64), (UInt), (Int), (Float), (Double), (Float80), (String, radix: Int), (CGFloat), (NSNumber)
return yyDefaultAction[Int(state)]
^
../../src/CitronParser.swift:284:16: error: cannot invoke initializer for type 'Int' with an argument list of type '(Self.CitronStateNumber)'
assert(Int(state) < yyReduceOffset.count)
^
../../src/CitronParser.swift:284:16: note: overloads for 'Int' exist with these partially matching parameter lists: (Int64), (Word), (UInt8), (Int8), (UInt16), (Int16), (UInt32), (Int32), (UInt64), (UInt), (Int), (Float), (Double), (Float80), (String, radix: Int), (CGFloat), (NSNumber)
assert(Int(state) < yyReduceOffset.count)
^
../../src/CitronParser.swift:285:32: error: cannot invoke initializer for type 'Int' with an argument list of type '(Self.CitronStateNumber)'
var i = yyReduceOffset[Int(state)]
^
../../src/CitronParser.swift:285:32: note: overloads for 'Int' exist with these partially matching parameter lists: (Int64), (Word), (UInt8), (Int8), (UInt16), (Int16), (UInt32), (Int32), (UInt64), (UInt), (Int), (Float), (Double), (Float80), (String, radix: Int), (CGFloat), (NSNumber)
var i = yyReduceOffset[Int(state)]
^
../../src/CitronParser.swift:288:26: error: binary operator '<' cannot be applied to operands of type 'Self.CitronSymbolCode' and 'Int'
assert(lookAhead < yyNumberOfSymbols)
~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
../../src/CitronParser.swift:288:26: note: expected an argument list of type '(Int, Int)'
assert(lookAhead < yyNumberOfSymbols)
^
../../src/CitronParser.swift:314:27: error: binary operator '<' cannot be applied to operands of type 'Self.CitronRuleNumber' and 'Int'
assert(ruleNumber < yyRuleInfo.count)
~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
../../src/CitronParser.swift:314:27: note: expected an argument list of type '(Int, Int)'
assert(ruleNumber < yyRuleInfo.count)
^
../../src/CitronParser.swift:316:54: error: cannot invoke initializer for type 'Int' with an argument list of type '(Self.CitronRuleNumber)'
tracePrint("Reducing with rule:", yyRuleText[Int(ruleNumber)])
^
../../src/CitronParser.swift:316:54: note: overloads for 'Int' exist with these partially matching parameter lists: (Int64), (Word), (UInt8), (Int8), (UInt16), (Int16), (UInt32), (Int32), (UInt64), (UInt), (Int), (Float), (Double), (Float80), (String, radix: Int), (CGFloat), (NSNumber)
tracePrint("Reducing with rule:", yyRuleText[Int(ruleNumber)])
^
../../src/CitronParser.swift:320:35: error: cannot invoke initializer for type 'Int' with an argument list of type '(Self.CitronRuleNumber)'
let ruleInfo = yyRuleInfo[Int(ruleNumber)]
^
../../src/CitronParser.swift:320:35: note: overloads for 'Int' exist with these partially matching parameter lists: (Int64), (Word), (UInt8), (Int8), (UInt16), (Int16), (UInt32), (Int32), (UInt64), (UInt), (Int), (Float), (Double), (Float80), (String, radix: Int), (CGFloat), (NSNumber)
let ruleInfo = yyRuleInfo[Int(ruleNumber)]
^
../../src/CitronParser.swift:384:15: error: binary operator '>' cannot be applied to operands of type 'Self.CitronSymbolCode' and 'Int'
if (i > 0 && i < yySymbolName.count) { return yySymbolName[Int(i)] }
~ ^ ~
../../src/CitronParser.swift:384:15: note: expected an argument list of type '(Int, Int)'
if (i > 0 && i < yySymbolName.count) { return yySymbolName[Int(i)] }
^
../../src/CitronParser.swift:384:68: error: cannot invoke initializer for type 'Int' with an argument list of type '(Self.CitronSymbolCode)'
if (i > 0 && i < yySymbolName.count) { return yySymbolName[Int(i)] }
^
../../src/CitronParser.swift:384:68: note: overloads for 'Int' exist with these partially matching parameter lists: (Int64), (Word), (UInt8), (Int8), (UInt16), (Int16), (UInt32), (Int32), (UInt64), (UInt), (Int), (Float), (Double), (Float80), (String, radix: Int), (CGFloat), (NSNumber)
if (i > 0 && i < yySymbolName.count) { return yySymbolName[Int(i)] }
^
make: *** [expr] Error 1

@roop roop self-assigned this Feb 12, 2018
@roop
Copy link
Owner

roop commented Feb 12, 2018

The first error seems to imply that you're on Swift 3.x or earlier. Can you confirm?

Citron requires Swift 4.

@roop
Copy link
Owner

roop commented Feb 18, 2018

To repeat: Which version of Swift are you using?

@roop
Copy link
Owner

roop commented Feb 19, 2018

I'm closing this under the assumption that you're using Swift 3. Please reopen if you're seeing this in Swift 4 or later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants